15 , CSS 背景與列表
1.CSS 中背景的使用
2.CSS 中列表的使用
15.1 CSS 中背景的使用
屬性名稱 屬性值 說明
background-attachment scroll 設置背景圖像會隨視窗滾動
條的移動而移動。
fixed 設置背景圖像不會隨視窗滾動條
的移動而移動。
background-color 十六進制 background-color:#ff0000;
英文名稱 background-color:red;
三原色 background-color:rgb(255,0,0)
transparent background-color:transparent;透明
background-image URL background-image:url("bg.jpg")
背景圖片
none 不設置背景圖片
background-position top left 設置背景圖案出現在上左方。
top center 設置背景圖案出現在上方中間。
top right 設置背景圖案出現在上右方。
center left 設置背景圖案出現在中間左方。
center center 設置背景圖案出現在IE中間。
center right 設置背景圖案出現中間右方。
bottom left 設置背景圖案出現在下左方。
bottom 設置背景圖案出現在正下方。
bottom right 設置背景圖案出現在下右方。
background-repeat repeat 將背景圖案填滿整個背景。
repeat-x 將背景圖案在水平方向添滿。
repeat-y 將背景圖案在垂直方向添滿。
no-repeat 圖案只出現一次。
背景圖案簡化方案:
background:顏色 背景圖片 repeat attachment position
15.2 CSS中列表的使用
屬性名稱 屬性值 說明
list-style-type none 無符號
disc 實體的小圓點。
circle 空心的小圓點。
square 實心的小方塊。
decimal 1,2,3...
lower-roman i,ii,iii...
upper-roman I,II,III...
lower-alpha a,b,c,d,e...
upper-alpha A,B,C,D,E...
list-style-position inside 清單項目較往右移。
outside 清單項目正常顯示。
list-style-image URL list-style-image:url(lmk.gif)
none 不會顯示任何圖象
清單的簡化設置:
list-style:circle inside url("bullet.gif")
CSS 11中背景的使用背景圖像會隨視窗滾動
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>設置背景圖像不會隨視窗滾動條 的移動而移動。</title> <style type="text/css"> body{ background-image:url(images/pic7.jpg); background-attachment:fixed; } </style> </head> <body> <p>scroll 設置背景圖像不會隨視窗滾動條 的移動而移動。</p> <p>scroll 設置背景圖像會隨視窗滾動 條的移動而移動。 fixed 設置背景圖像不會隨視窗滾動條 的移動而移動。</p> <p>scroll 設置背景圖像會隨視窗滾動 條的移動而移動。 fixed 設置背景圖像不會隨視窗滾動條 的移動而移動。</p> <p>scroll 設置背景圖像會隨視窗滾動 條的移動而移動。 fixed 設置背景圖像不會隨視窗滾動條 的移動而移動。</p> <p>scroll 設置背景圖像會隨視窗滾動 條的移動而移動。 fixed 設置背景圖像不會隨視窗滾動條 的移動而移動。</p> <p>scroll 設置背景圖像會隨視窗滾動 條的移動而移動。 fixed scroll 設置背景圖像會隨視窗滾動 條的移動而移動。 fixed 設置背景圖像不會隨視窗滾動條 的移動而移動。 的移動而移動。</p> <p>scroll 設置背景圖像會隨視窗滾動 條的移動而移動。 fixed 設置背景圖像不會隨視窗滾動條 的移動而移動。</p> <p>scroll 設置背景圖像會隨視窗滾動 條的移動而移動。 fixed 設置背景圖像不會隨視窗滾動條 的移動而移動。</p> <p>scroll 設置背景圖像會隨視窗滾動 條的移動而移動。 fixed 設置背景圖像不會隨視窗滾動條 的移動而移動。</p> <p>scroll 設置背景圖像會隨視窗滾動 條的移動而移動。 fixed 設置背景圖像不會隨視窗滾動條 的移動而移動。</p> <p>scroll 設置背景圖像會隨視窗滾動 條的移動而移動。 fixed 設置背景圖像不會隨視窗滾動條 的移動而移動。</p> <p>scroll 設置背景圖像會隨視窗滾動 條的移動而移動。 fixed 設置背景圖像不會隨視窗滾動條 的移動而移動。</p> <p>scroll 設置背景圖像會隨視窗滾動 條的移動而移動。 fixed 設置背景圖像不會隨視窗滾動條 的移動而移動。</p> <p>scroll 設置背景圖像會隨視窗滾動 條的移動而移動。 fixed 設置背景圖像不會隨視窗滾動條 的移動而移動。</p> <p>scroll 設置背景圖像會隨視窗滾動 條的移動而移動。 fixed 設置背景圖像不會隨視窗滾動條 的移動而移動。</p> <p>scroll 設置背景圖像會隨視窗滾動 條的移動而移動。 fixed 設置背景圖像不會隨視窗滾動條 的移動而移動。</p> <p>scroll 設置背景圖像會隨視窗滾動 條的移動而移動。 fixed 設置背景圖像不會隨視窗滾動條 的移動而移動。</p> <p>scroll 設置背景圖像會隨視窗滾動 條的移動而移動。 fixed 設置背景圖像不會隨視窗滾動條 的移動而移動。</p> <p>scroll 設置背景圖像會隨視窗滾動 條的移動而移動。 fixed 設置背景圖像不會隨視窗滾動條 的移動而移動。</p> <p>scroll 設置背景圖像會隨視窗滾動 條的移動而移動。 fixed 設置背景圖像不會隨視窗滾動條 的移動而移動。</p> <p>scroll 設置背景圖像會隨視窗滾動 條的移動而移動。 fixed 設置背景圖像不會隨視窗滾動條 的移動而移動。</p> <p>scroll 設置背景圖像會隨視窗滾動 條的移動而移動。 fixed 設置背景圖像不會隨視窗滾動條 的移動而移動。</p> <p>scroll 設置背景圖像會隨視窗滾動 條的移動而移動。 fixed 設置背景圖像不會隨視窗滾動條 的移動而移動。</p> <p>scroll 設置背景圖像會隨視窗滾動 條的移動而移動。 fixed 設置背景圖像不會隨視窗滾動條 的移動而移動。</p> <p>scroll 設置背景圖像會隨視窗滾動 條的移動而移動。 fixed 設置背景圖像不會隨視窗滾動條 的移動而移動。</p> <p>scroll 設置背景圖像會隨視窗滾動 條的移動而移動。 fixed 設置背景圖像不會隨視窗滾動條 的移動而移動。</p> <p>scroll 設置背景圖像會隨視窗滾動 條的移動而移動。 fixed 設置背景圖像不會隨視窗滾動條 的移動而移動。</p> <p>scroll 設置背景圖像會隨視窗滾動 條的移動而移動。 fixed 設置背景圖像不會隨視窗滾動條 的移動而移動。</p> <p>scroll 設置背景圖像會隨視窗滾動 條的移動而移動。 fixed 設置背景圖像不會隨視窗滾動條 的移動而移動。</p> <p>scroll 設置背景圖像會隨視窗滾動 條的移動而移動。 fixed 設置背景圖像不會隨視窗滾動條 的移動而移動。</p> <p>scroll 設置背景圖像會隨視窗滾動 條的移動而移動。 fixed 設置背景圖像不會隨視窗滾動條 的移動而移動。</p> <p>scroll 設置背景圖像會隨視窗滾動 條的移動而移動。 fixed 設置背景圖像不會隨視窗滾動條 的移動而移動。</p> <p>scroll 設置背景圖像會隨視窗滾動 條的移動而移動。 fixed 設置背景圖像不會隨視窗滾動條 的移動而移動。</p> <p>scroll 設置背景圖像會隨視窗滾動 條的移動而移動。 fixed 設置背景圖像不會隨視窗滾動條 的移動而移動。</p> <p>scroll 設置背景圖像會隨視窗滾動 條的移動而移動。 fixed 設置背景圖像不會隨視窗滾動條 的移動而移動。</p> <p>scroll 設置背景圖像會隨視窗滾動 條的移動而移動。 fixed 設置背景圖像不會隨視窗滾動條 的移動而移動。</p> <p>scroll 設置背景圖像會隨視窗滾動 條的移動而移動。 fixed 設置背景圖像不會隨視窗滾動條 的移動而移動。</p> <p>scroll 設置背景圖像會隨視窗滾動 條的移動而移動。 fixed 設置背景圖像不會隨視窗滾動條 的移動而移動。</p> <p>scroll 設置背景圖像會隨視窗滾動 條的移動而移動。 fixed 設置背景圖像不會隨視窗滾動條 的移動而移動。</p> <p>scroll 設置背景圖像會隨視窗滾動 條的移動而移動。 fixed 設置背景圖像不會隨視窗滾動條 的移動而移動。</p> <p>scroll 設置背景圖像會隨視窗滾動 條的移動而移動。 fixed 設置背景圖像不會隨視窗滾動條 的移動而移動。</p> <p>scroll 設置背景圖像會隨視窗滾動 條的移動而移動。 fixed 設置背景圖像不會隨視窗滾動條 的移動而移動。</p> <p>scroll 設置背景圖像會隨視窗滾動 條的移動而移動。 fixed 設置背景圖像不會隨視窗滾動條 的移動而移動。</p> <p>scroll 設置背景圖像會隨視窗滾動 條的移動而移動。 fixed 設置背景圖像不會隨視窗滾動條 的移動而移動。</p> <p>scroll 設置背景圖像會隨視窗滾動 條的移動而移動。 fixed 設置背景圖像不會隨視窗滾動條 的移動而移動。</p> <p>scroll 設置背景圖像會隨視窗滾動 條的移動而移動。 fixed 設置背景圖像不會隨視窗滾動條 的移動而移動。</p> <p>scroll 設置背景圖像會隨視窗滾動 條的移動而移動。 fixed 設置背景圖像不會隨視窗滾動條 的移動而移動。</p> <p>scroll 設置背景圖像會隨視窗滾動 條的移動而移動。 fixed 設置背景圖像不會隨視窗滾動條 的移動而移動。</p> </body> </html>
CSS 12中背景顏色的設置
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>背景顏色的設置</title> <style type="text/css"> p{ background-image: image() } </style> </head> <body> <P>背景顏色的設置:十六進制</P> <span>背景顏色的設置:英文名稱</span> <h1>背景顏色的設置:三原色</h1> <h2>背景顏色的設置:transparent,透明</h2> </body> </html>
CSS 13將背景圖案只出現一次
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>no-repeat 圖案只出現一次</title> <style type="text/css"> body{ background-image:url(images/pic7.jpg); background-repeat:no-repeat; } </style> </head> <body> <P><pre> background-repeat repeat 將背景圖案填滿整個背景。 repeat-x 將背景圖案在水平方向添滿。 repeat-y 將背景圖案在垂直方向添滿。 no-repeat 圖案只出現一次。 </pre></P> </body> </html>
CSS 14背景圖案出現在上方中間
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>設置背景圖案出現在上方中間</title> <style type="text/css"> body{ background-image:url(images/pic7.jpg); background-repeat:no-repeat; background-position: top center; } </style> </head> <body> <P><pre> background-position top left 設置背景圖案出現在上左方。 top center 設置背景圖案出現在上方中間。 top right 設置背景圖案出現在上右方。 center left 設置背景圖案出現在中間左方。 center center 設置背景圖案出現在IE中間。 center right 設置背景圖案出現中間右方。 bottom left 設置背景圖案出現在下左方。 bottom 設置背景圖案出現在正下方。 bottom right 設置背景圖案出現在下右方。 背景圖案簡化方案: background:顏色 背景圖片 repeat attachment position </pre></P> </body> </html>
CSS 15CSS中列表的使用
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>CSS中列表的使用</title> <style type="text/css"> ul{ list-style-type: decimal; list-style-position:inside; } li{ background:url(images/2.jpg) no-repeat left center; padding-left:18px; } </style> </head> <body> <ul> <li>CSS中列表的使用</li> <li>CSS中列表的使用</li> <li>CSS中列表的使用</li> </ul> <P><pre> 屬性名稱 屬性值 說明 list-style-type none 無符號 disc 實體的小圓點。 circle 空心的小圓點。 square 實心的小方塊。 decimal 1,2,3... lower-roman i,ii,iii... upper-roman I,II,III... lower-alpha a,b,c,d,e... upper-alpha A,B,C,D,E... list-style-position inside 清單項目較往右移。 outside 清單項目正常顯示。 list-style-image URL list-style-image:url(lmk.gif) 用的比較少,一般用背景圖片 none 不會顯示任何圖象 清單的簡化設置: list-style:circle inside url("bullet.gif") </pre></P> </body> </html>
15 , CSS 背景與列表