zoukankan      html  css  js  c++  java
  • CSS 选择器

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
        <style>
            /*#i11{*/
            /*background: #FAFAD2;*/
            /*height: 100px*/
        /*}*/
        /*.c1{*/
            /*background: #FFD39B;*/
            /*height: 100px*/
        /*}*/
            /*div{*/
                /*background: black;*/
                /*color: white;*/
            /*}*/
    
            /*span div {*/
                /*background: #FAFAD2;*/
                /*color: brown;*/
            /*}*/
        #i1,#i2,#i3 {
            background: aliceblue;
            color: black;
        }
        /*input[type=text]{ 100px;height: 50px }*/
    
        /*input[type=test]{ 100px;height: 50px }*/
    
        .c1[n=test]{width: 100px;height: 150px }
    
        </style>
    
    
    </head>
    <body>
        <div id="i11">1</div>
        <div class="c1">1</div>
        <span class="c1">sasafsaf
            <div>12345</div>
        </span>
    
        <div id="i1">2</div>
        <div id="i2">3</div>
        <div id="i3">4</div>
    
        <input class="c1" type="text" n="test">
        <input class="c1" type="password">
    </body>
    </html>
    View Code


    CSS
        在标签上设置style属性
                background: #FAFAD2;
                height: 100px
        编写CSS样式:
            1.标签的style属性
            2.写在head里面,style标签中写样式
                - id选择区
                        <style>#i11{
                            background: #FAFAD2;
                            height: 100px
                        }</style>
                        
                - class选择器
                    .c1{
                    background: #FFD39B;
                    height: 100px
                        }
                    <标签 class="c1"><标签/>
                - 标签选择器:
                     div{
                     ....
                     }
                     所有div 设置上此样式
                -层级选择器
                    c1.c2 div{
                    ....    
                    }
                - 组合选择器(逗号分隔)
                        #i1,#i2,#i3 {
                            background: aliceblue;
                            color: black;
                                    }
                                        
                - 属性选择器
                    对选择到的标签再通过属性再进行一次筛选

      3.注释
                /* 内容 */

  • 相关阅读:
    Mvc+三层(批量添加、删除、修改)
    js中判断复选款是否选中
    EF的优缺点
    Git tricks: Unstaging files
    Using Git Submodules
    English Learning
    wix xslt for adding node
    The breakpoint will not currently be hit. No symbols have been loaded for this document."
    Use XSLT in wix
    mfc110ud.dll not found
  • 原文地址:https://www.cnblogs.com/anhao-world/p/14047021.html
Copyright © 2011-2022 走看看