css one

css樣式:

  1    內嵌        書寫在style後面的「」裏,若有多條樣式代碼則用分號隔開      如 <p  style="cloor:red";font-size: 13px";>紅色文字十三號字體css

  2    內聯        書寫方式(得在<head>標記中 )字體

                                                   格式       <style>spa

                                                                          p{it

                                                                              background-color:skyblueast

                                                                            }class

                                                                </style>循環

 3  外聯        書寫方式於內聯一 的樣得在<head>標記中樣式

                                                     格式  <link rel="styleheet"   heef="  要使用的css路徑">僞元素

 

選擇器:vi

                            元素選擇器(標籤選擇器)如 p標籤 a標籤 li標籤  ul標籤 等

                                                                         p{

                                                                             font-size:20px;

                                                                           }

               id選擇器   (此處box1是元素值)

                                                          #box1{

                                                                         ..............

                                                                     }

               class選擇器(l類選擇器)

                                                          .box1{

                                                                    ...............

                                                                    }

               屬性選擇器

                              若是但願選擇有某個屬性的元素,而不論屬性值是什麼,能夠使用簡單屬性選擇器

                                   把包含標題(title)的全部元素變爲紅色

                                                                                      *[title] {color:red;}

                                例如,爲了將同時有 href 和 title 屬性的 HTML 超連接的文本設置爲紅色,能夠這樣寫:               

                                      a[href][title]{

                                       color:red;

                                       }

              

                  僞元素選擇器

                                     :first-line{              }                第一行

                                     :first-letter{               }            第一列

                                      :before{                 }                在xx以前

                                      :after{                }                    在xx以後         

                    

                  僞類選擇器

                                    :link{               }                       未被訪問

                                     :visited{               }                    訪問之後               

                                     :hover{             }                        當鼠標懸停

                                     :active{              }                       點擊時

                         

                   僞類選擇器

                                   :nth-child( 數字 )                                       同類兄弟中順數第   個 

                                   :nth-last-child( 數字 )                                 同類兄弟中倒數第    個 

                                   :first-child{                }                             同類兄弟中第一個 

                                    :last-child{                 }                             同類兄弟中最後一個 

                                    :nth-child(odd){                }                     同類兄弟中的奇數項

                                    nth-child(even){                }                    同類兄弟中偶數項

                                    nth-child(數字n+數字){                }            同類兄弟中每  x 個循環

                   通配符(經常使用語於頁面前)

                           *{

                                ................

                             }

                    並集選擇器(不限元素)

                                如

                                 h1,h2,...h6{

                                                  ...................

                                  }

                      後代選擇器(被選中級的子級也會被選上)

                                                                           如 span{

                                                                                         ..........

                                                                                         }

                       子級選擇器(只會選中第一子級)

                                                                          如 ul > li{

                                                                                       ......................

                                                                                       }

相關文章
相關標籤/搜索