以下整理常見 CSS 屬性,方便開發時快速查閱。內容涵蓋背景、邊框、文字、字體、間距、尺寸、列表、表格與定位等常用分類。
background 可一次設定多個背景相關屬性,常見子屬性包含 background-color、background-image、background-position、background-repeat 與 background-attachment。
border 用於設定元素邊框,可拆成 border-top、border-right、border-bottom、border-left,也能分別設定寬度、樣式與顏色。outline 則常用於焦點提示,不占據版面空間。
常見文字屬性包含 color、text-align、text-decoration、text-indent、line-height、letter-spacing、word-spacing、white-space 與 text-shadow。
font 是可一次設定多項字體樣式的簡寫屬性,常見子屬性包含 font-family、font-size、font-style、font-weight 與 font-variant。
margin 控制元素外部間距,padding 控制元素內部間距。兩者都可拆成上、右、下、左四個方向,也可使用簡寫一次設定。
常見尺寸屬性包含 width、height、min-width、max-width、min-height 與 max-height。響應式設計中常搭配百分比、rem 或 viewport 單位。
列表屬性包含 list-style、list-style-type、list-style-image 與 list-style-position。表格屬性則包含 border-collapse、border-spacing、caption-side、empty-cells 與 table-layout。
定位相關屬性包含 position、top、right、bottom、left、z-index、float、clear、display、visibility 與 overflow。這些屬性會直接影響元素在畫面上的呈現方式。