CSS 書寫順序

2021-06-02 05:07:37 字數 1064 閱讀 8950

display || visibility

list-style : list-style-type || list-style-position || list-style-image

position

top || right || bottom || left

z-index

clear

float

width

max-width || min-width

height

max-height || min-height

overflow || clip

margin : margin-top || margin-right || margin-bottom || margin-left

padding : padding-top || padding-right || padding-bottom || padding-left

outline : outline-color || outline-style || outline-width

border

background : background-color || background-image || background-repeat || background-attachment || background-position

color

font : font-style || font-variant || font-weight || font-size || line-height || font-family

字型名稱。按優先順序排列。以逗號隔開。如果字型名稱包含空格,則應使用引號括起

font : caption | icon | menu | message-box | small-caption | status-bar

text-overflow

text-align

text-indent

line-height

white-space

vertical-align

cursor

收藏自 css書寫順序 

CSS書寫順序

以前一直以為css 沒什麼可優化之處,直到前幾天看到一篇文章,用良好的css書寫習慣來寫css 這樣會提高 的閱讀體驗。css書寫順序 1.位置屬性 position,top,right,z index,display,float,clear等 2.大小 width,height,padding,m...

Css樣式書寫順序

我不知道是否有人嚴格按照一定的順序來書寫css的樣式,可以說幾乎都是需要什麼樣式就加什麼樣式,完全沒有考慮過樣式屬性書寫的順序對效能有什麼影響。我一直堅信,前端的效能優化都是從細節堆出來的,不注意css屬性的順序確實也可以實現我們需要的各種操作,但是慢慢的讓自己遵從最優的寫法,提高自己或者是優秀自己...

CSS屬性書寫順序

建議遵循以下順序 1 布局定位屬性 display position float clear visibility overflow 建議display第乙個寫,畢竟關係到模式 2 自身屬性 盒模型 width height margin padding border background 3 文字...