CSS基礎--常用樣式
阿新 • • 發佈:2017-07-26
mage rgb 方式 idt 單位 ont nbsp jpeg ima
一、背景相關 |
- 背景顏色
background-color :顏色名稱/rgb值/十六進制值
- 背景圖片
background-image :url(‘‘)
- 背景圖片平鋪方式
background-repeat : repeat-x(僅水平平鋪) repeat-y(僅垂直平鋪) no-repeat(不平鋪)
- 設置背景圖片位置
background-position : 數字+單位/center/top/bottom/left/right 同上。 例如:50px 50px
- 背景圖片是否滾動
background-attachment : fixed(不滾動) scroll(滾動)
dmeo:
設置頁面的body背景:
<!DOCTYPE html> <html lang="en"> <head> </head> <style> body{ background-color: aquamarine; background-image: url("cool.jpeg"); background-repeat:repeat-y ; background-position: top; background-attachment: fixed; } </style> <body> </body> </html>
二、邊框 |
邊框:border
用法:
border: 1px solid red; 表示邊框寬度(border-width)為1px,邊框樣式(border-style)為實線,邊框顏色(border-color)為紅色
其中常用的邊框樣式有:solid 實線 dashed 虛線 dotted 點線
border表示全部設置,單獨設置邊框上/下/左/右邊框將border替換為border-top、border-bottom、border-left、border-right。
CSS基礎--常用樣式