插入图片的方法
在html代码段的style标签中对直接对body元素进行设置,可以直接插入一张图片作为背景,例如:
body{background-image:url(G:/test.com/bj.jpg);//url中放置图片的位置地址;
background-repeat:no-repeat;设置背景重复属性为“不重复”;
background-size:100% 100%;//修改图片大小使其铺满整个网页;
background-attachment:fixed;//background-attachment 属性设置为 "fixed",保证该属性在 Firefox 和 Opera 中的正常工作;
background-opacity:0.1;//设置图片透明度属性opacity,它的取值范围为0.0~1.0,其中值越小表示图片越透明;兼容性:IE9, Firefox, Chrome, Opera 和 Safari 都可以使用;
filter:alpha(opacity=10);//对于IE8及其之前的版本使用此语句定义透明度。
}
设置body的背景颜色方法同上例。