网页样式设计--CSS

13,颜色和背景属性

body {background-color:yellow}

h1 {background-color:red}

上面的语句指整个页面的背景色为黄色,h1中的背景色为红色

 

body {background-image:url(back.jpg)}

P {background-image:none}

上面的语句指页面的背景图片是back.jpg,P中没有背景图片,当然你也可以加入背景图片

 

body {background:red url(back.jpg);background-repeat:repeat-y}    (效果演示)

上面的语句指页面为红色(如果没有背景图片时),而且背景图片垂直排列。

注意:repeat-x指水平排列,repeat-y指垂直排列,no-repeat指不重复。

 

body {background:red url(back.jpg);background-repeat:repeat-y;background-attachment:scroll}

注意:background-attachment:fixed 表示背景图片永远静止,文字在背景上面"流动"

background-attachment:scroll 表示背景图片随着页面上的文字一起"流动"

 

 

body {background:url(back.jpg) right top} /*right top=100% 0% */

body {background:url(back.jpg) top center} /*top center=50% 0% */

body {background:url(back.jpg) center} /*center=50% 50% 指背景图片居中*/

body {background:url(back.jpg) bottom} /* bottom=50% 100% */

 


800*600以上分辨率 IE6.0以上
本站由盼盼的家园(盼盼)制作维护
本站域名:www.panpan.org
©2008-2012 版权所有