• css选择器


    css五大选择器

    一.类选择器:用.+名称定义的css样式类型,叫类选择器在class中引用

    .comment{
        background-color: #0bbb15;
        color: white;
        margin: 20px;
        padding: 20px;
     
    }
     
    <div class=“comment">

    二.id选择器:用#+名称定义的css样式类型,叫id选择器,在id中应用

    #header{
        background-color: #0a0a0a;
        color: white;
        text-align: center;
        padding: 5px;
     
    }
     
    <div id=“header”>

    三.派生选择器:根据文档的上下文关系来确定某个标签的样式叫派生选择器

    li strong {
        font-style: italic;
        font-weight: normal;
     
      }
     
    <li><strong>我是斜体字。这是因为 strong 元素位于 li 元素内。</strong></li>
     

     

    四.元素选择器

    p {font-size: 30px; backgroud-color: gray;}
     
    h2 {background-color: red;}
     
    后面中所有p和h2的元素都使用上面定义的样式
     
    <p>111</p>
     
    <h2>222</h2>

    五.属性选择器:属性选择器在css2中引入,使我们可以根据元素的属性及属性值来选择元素

    [title]
     
     {
     
         color:red;
     
     }
     
    <h title=“hell”>hello</h>

    具体可见:https://www.cnblogs.com/shihaiying/p/11332700.html

  • 相关阅读:
    Document
    Document
    Document
    Document
    Document
    Document
    Document
    Document
    export和import 输出/接收模块变量的接口
    webpack:(模块打包机)
  • 原文地址:https://www.cnblogs.com/linmob/p/14140755.html
Copyright © 2020-2023  润新知