如何定位CSS中的下一个元素? [英] How do I target the next element in css?

查看:1385
本文介绍了如何定位CSS中的下一个元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不确定这是否可行,但是是否可以在div类下面标识div?如果是这样,我会怎么做?

I'm not sure if this is possible, but is it possible to identify the div just below the div class? If so, what would I use to do it?

<div class="img-wrap">
<div></div> <---------------- This
<div class="img-wrap">
<div></div> <---------------- This
<div></div>
<div></div>
<div></div>
<div class="img-wrap">
<div></div> <---------------- This

推荐答案

使用相邻的同级选择器+:

Use +, the adjacent sibling selector:

div.img-wrap + div
{
}

这篇关于如何定位CSS中的下一个元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆