|
---|
標籤 | 語法 |
background-color (背景顏色) | background-color:#000000或 background-color:black |
任何一個被定義的元件 (例如超連結、文字、表格等),也可以有自己的背景顏色 | |
例如:<font style="background-color:red">網頁研習室</font> | |
結果:網頁研習室 | |
background-image (背景圖片) | background-image:url(xxx.jpg)每個元件可設背景圖片 原始碼 網頁研習室 |
background-position (背景圖片位置) | Background-position:75% 25%(基準點是元件的左上角,第一個參數是指定X方向,第二個指定Y方向)或 75px 25px或 right top[X方向可指定為left(0%)、center(50%)、right(100%),Y方向可以指定為top(0%)、center(50%)、bottom(100%)] |
background-repeat (背景的重複) | background-repeat:repeat[repeat(一般貼的滿滿的狀況)、repeat-x(只往x方向貼滿)、repeat-y(往Y方向貼滿)、no-repeat(不重複貼,也就是只有一張小圖) |
background-attachment (背景是否固定) | background-attachment:scroll指定為scroll(一般效果)、fixed(固定不動)。 |
background(background家族總管)上面所介紹的所有background語法,我們可以用它來一次設定完畢。 | |
原寫法: {background-color:red;background-repeat:repeat} | |
總管寫法:{background:red repeat}在不同的設定間加一個空白鍵 |