CSS 选择器分类

CSS 选择器分类

   普通选择器:使用HTML元素标签座位选择器。

      如:  p{ font-size:24px; }

   派生选择器:通过依据元素在其位置的上下文关系定义样式,是标记更加简洁。

      如:  h2 strong{color:bule;}

          <h2>The strongly emphasized word in this subhead is<strong>blue</strong>.</h2>

          // h2 strong影响以上的blue文本。

   id 选择器:为标记特定id的HTML元素指定特定的样式。

      如:   #red {color:red}

           <p id="red">这个段落是红色。</p>  //id为red的元素的字符为红色。

   类选择器:类选择器以一个点号显示。

      如:      .center {text-align: center}

          <h1 class="center">This heading will be center-aligned</h1> 

           //class为“center”的多个元素都水平居中对齐

转载于:https://www.cnblogs.com/lanchong/archive/2010/07/20/1781584.html

猜你喜欢

转载自blog.csdn.net/weixin_33772645/article/details/94705296
今日推荐