首页 > Web开发 > 详细

css 元素选择器

时间:2019-11-30 09:49:24      阅读:73      评论:0      收藏:0      [点我收藏+]

子元素选择器

h1 > strong {color:red;}
//这个规则会把第一个 h1 下面的两个 strong 元素变为红色,但是第二个 h1 中的 strong 不受影响:

<h1>This is <strong>very</strong> <strong>very</strong> important.</h1>
<h1>This is <em>really <strong>very</strong></em> important.</h1>

 后代选择器(descendant selector)又称为包含选择器

h1 em {color:red;}
//上面这个规则会把作为 h1 元素后代的 em 元素的文本变为 红色。其他 em 文本(如段落或块引用中的 em)则不会被这个规则选中:
<h1>This is a <em>important</em> heading</h1>
<p>This is a <em>important</em> paragraph.</p>

 

css 元素选择器

原文:https://www.cnblogs.com/-constructor/p/11961161.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!