css樣式表

來源:互聯網
上載者:User

標籤:dss   red   標籤   utf-8   har   name   add   round   set   

            樣式表主要分為三類:內聯式、內嵌式和外部樣式表。

            內聯式樣式表是跟html聯合顯示,寫在body標籤裡邊,屬於控制精確,但是可用性差。在三種樣式中會優先顯示作用。

            內嵌式是作為獨立地區寫在head標籤裡邊。body標籤中有對應的標籤:<div id/name/class="  "></div>。

            外部樣式表是建立一個css檔案,用來放樣式表,在html中用link連結。

<link type="text/css" rel="stylesheet" href="../../css/new_file.css"/>
<html>    <head>        <meta charset="UTF-8">        <title></title>        <style>            /*網頁內容邊距*/            *{            margin: 10px;            padding:10px ;        }            /*id選取器*/        #div1{            width: 100px;        height: 100px;        background-color: red;                    }        /*class選取器*/        .div-class{width: 200px;        height: 200px;        background-color: black;                    }        /*標籤選取器*/        div{            border: 5px; solid salmon;        }                        /*屬性選取器   名稱可以自訂*/        [name=n]{            width: 300px;        height: 300px;        background-color: blueviolet;        }                /*複合選取器*/        /*並欄選取器*/        .c,.c2{            width: 200px;            height: 200px;            background-color: brown;        }        /*子代選取器*/        .cc span{            color: red;        }                /*其他*/        .x1{            width: 500px;                    }        .x2{height: 500px;            background-color: cadetblue;                    }                </style>        <link type="text/css" rel="stylesheet" href="../../css/new_file.css"/>    </head>    <body>        <!--第一種直接引用(優先)-->        <div style="width: 100px; height: 100px; background-color: darkblue;">ssddd</div>        <!--第二種-->        <div id="div1"></div>        <!--第三種-->            <div id="div2"></div>        <div class="div-class"></div>                    <!--            id 不可重複   class  可以重複     name 可以重複        -->                <div sb=n></div>        <div class="c"></div>        <div class="c2"></div>        <div class="cc">            <span>ffddsssssssd</span>        </div>        <span>ffddsssssssd</span>                        <div class="x1 x2"></div>    </body></html>

             在樣式表中表示大小要有px。網頁編輯過程中可將內嵌式樣式表與對應的標籤寫在一起,完成後統一排版寫在head裡,或者移到外部樣式表css檔案中。在css檔案中樣式表不帶style標籤。



css樣式表

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.