如何添加css元素的范围从某个类到某些类?如何添加css元素的范围从某个类到某些类
我有以下要素:
[roletype~='start-content']{
border-top: 1px solid blue;
border-left:1px solid blue;
border-right:1px solid blue;
margin:0;
}
[roletype~='start-content']~* {
border-left:1px solid blue;
border-right:1px solid blue;
margin:0;
}
[roletype~='end-content']{
border-bottom: 1px solid blue;
border-left:1px solid blue;
border-right:1px solid blue;
margin:0;
}
<p roletype="role start-content">sdfdfsdddsd</p>
<p>sdfsddfsdds</p>
<p>sdfsddfsdds</p>
<p>sdfsddfsdds</p>
<p>sdfsddfsdds</p>
<p>sdfsddfsdds</p>
<div roletype="role end-content">sdfdfsdddsd</div>
<div>any div which does not want border<br>but the border is still vissible to this also</div>
<p>any div which does not want border<br>but the border is still vissible to this also</p>
<p>any div which does not want border<br>but the border is still vissible to this also</p>
<div roletype="role start-content">sdfdfsdddsd</div>
<p>sdfsddfsdds</p>
<p>sdfsddfsdds</p>
<p>sdfsddfsdds</p>
<p>sdfsddfsdds</p>
<p>sdfsddfsdds</p>
<div roletype="role end-content">sdfdfsdddsd</div>
我要添加CSS左边框:1px的固体蓝色;到从开始内容到结束内容范围内的所有元素。
它应该看起来像箱子,寻找CSS解决方案only..I了解JavaScript,jQuery的解决方案......
边界应为起点和终点,没有超出。 –