如何添加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的解決方案......
邊界應爲起點和終點,沒有超出。 –