我需要选择放在h1元素之后的第4个div元素,我认为我的方式不是专业的方式,css中有指定的选择器吗?请注意,我必须在不向div添加id或class属性的情况下执行此操作.
h1+div+div+div+div{
background-color:red;
}
<h1>css</h1>
<div>just some text here,</div><hr>
<div>just some text here,</div><hr>
<div>just some text here,</div><hr>
<div>just some text here,</div><hr>
<div>just some text here,</div><hr>
Run Code Online (Sandbox Code Playgroud)