CSS基礎1

亦世發表於2018-08-07
css  cascading style sheet  層疊樣式表


selector 選擇器   1,ID選擇器   2,類選擇器   3,標籤選擇器  4,萬用字元選擇器(*)5,屬性選擇器[屬性名|屬性名="屬性值"]{}

內聯樣式/行間樣式: <div style="width:100px"></div>

內部樣式表: <style type="text/css">...</style>--->寫在head的最底部

外部樣式表:<link rel="stylesheet" type="text/css" href="css/index.css" />

(href:hypertext reference)

權重(優先順序):內聯樣式>內部樣式>外部樣式

!important  權重最高

!important  > id > class|屬性 > 標籤 > *

派生選擇器  父子選擇器

不可以 #id #id


CSS權重


*                                   0

標籤,偽元素                1

class,屬性,偽類        10

id                                100

內聯樣式                     1000

!important               正無窮


並列選擇器

屬性&值

outline-color: green;

outline-style:dotted;

outline-width: 3px;

outline: none   --->開發中只用這個

瀏覽器對父子選擇器的匹配規則

匹配從右到左

一般id用_連線    class用-連線


相關文章