CSS基礎學習筆記

來源:互聯網
上載者:User

CSS選取器:

1、標記選取器:給html的所有相同標記設定同樣的CSS格式。

2、類別選取器:例如 .class { color:green;font-size:20px} class是類別名稱,color和font-size是屬性,green和20px分別是屬性對應的值。

3、ID選取器:用於頁面中某一個特殊的標記。 例如 #id { color:green;font-size:20px }

4、選取器的集體聲明:不同類別的選取器使用相同的CSS樣式。

5、CSS選取器的嵌套聲明:例如 p b{ color:green} 是指對html<p><b></b></p>對b標記的內容指定樣式。

6、CSS的子選取器:ul.mylist>li>a { color:green}    <body>

                                                                                    <ui>

                                                                                          <li><a href="">只對這個標記起作用</a>

                                                                                                <ui>

                                                                                                      <li><a href="">這個a標記不會有css樣式</a></li>

                                                                                                <ui/>

                                                                                          </li>

                                                                                    <ui/>

                                                                        </body>

 

相關文章

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.