Search This Blog

2016/11/28

CSS different child elements within a same parent同一阶层下的元素对应

HTML structure:
<div>
<span>element 1</span>
<p>element 2</p>
<p>element 3</p>
</div>

CSS:
div span {clear:both;}
div span + p {color: aquamarine;}
div span + p + p {color: blueviolet;}

No comments :

Post a Comment