我需要获取特定H1类文本的div类内部的信息。下面是HTML代码:
html
<head>
</head>
<body>
<h1 class="SAyv5">WHO Coronavirus disease (COVID-19) situation reports</h1>
<div> This content1 I need </div>
<div> This content2 I need </div>
<div> This content3 I need </div>
<p>This is my first page.</p>
<h1>A secondary header.</h2>
<div> This content4 I need </div>
<p>Some more text.</p>
</body>
这里我只需要div类的内容,它位于H1选项卡文本“世卫组织冠状病毒病(新冠病毒-19)情况报告”下。同样,有多个H1标签,但我需要访问他们只有一个H1标签文本我必须通过“世卫组织冠状病毒病(新冠病毒-19)情况报告”这一文本访问它们。
如果我理解正确,您可能正在寻找以下内容:
这将从
<div>
元素后面的所有<h1>
元素中输出具有所需文本的文本如果你需要在css中访问它们,我会这样做
html
CSS
相关问题 更多 >
编程相关推荐