寫網頁布局時,有些屬性幾乎每個專案都會用到。這裡把最常被翻查的幾大類整理成速查表,方便隨手對照。
background:#00ffee; /* 設置背景顏色 */
background-image:url(*.jpg); /* 設置背景圖片 */
background-repeat:repeat-x; /* 設置背景圖片重複方式 */
background-attachment:fixed; /* 設置背景不隨文字捲動 */
text-indent: 5em; /* 設置文本縮進 */
text-transform:uppercase; /* 大小寫轉換:uppercase / lowercase / capitalize */
text-decoration:none; /* 文本裝飾:none / underline / overline / line-through / blink */
white-space:normal; /* 空白符處理:normal / pre */
color:#eeffee; /* 設置文本顏色 */
line-height:30px; /* 設置行高 */
font-family: Georgia; /* 指定字體系列 */
font-style: normal; /* 正常 / italic 斜體 / oblique 傾斜 */
font-weight: normal; /* 粗細:normal / bold / 900 */
font-size: 16px; /* 大小,可用 px、em 等單位 */
font-variant: small-caps; /* 小型大寫字母 */
/* 有序列表 */
list-style-type: decimal;
list-style-type: decimal-leading-zero;
list-style-type: lower-roman;
list-style-type: upper-roman;
list-style-type: lower-alpha;
list-style-type: upper-alpha;
/* 無序列表 */
list-style-type: disc;
list-style-type: circle;
list-style-type: square;
border-collapse: collapse; /* 設定表格邊框合併 */
border: 1px solid black; /* 設定表格邊框 */
width: 100%; /* 設定表格寬度 */
height: 50px; /* 設定表格高度 */
text-align:right; /* 設定表格中文本的對齊方式 */
vertical-align:bottom; /* 設定表格垂直對齊方式 */
padding:15px; /* 設定表格內邊距 */
color:white; /* 設定表格中字體顏色 */
background-color:green; /* 設定表格背景顏色 */
outline: #00ff00 dotted thick; /* 設定輪廓顏色 / 樣式 / 寬度 */
border: blue solid thin; /* 設定邊框 */
補充一個實務觀念:border 與 outline 最大的差別在於 border 會佔據版面空間、會參與盒子模型的尺寸計算,而 outline 繪製在元素外部、不佔空間也不影響布局,因此常用於焦點狀態的視覺提示。