css中如何添加网页背景,

发布网友

我来回答

2个回答

热心网友

原有的网页代码修改,很久不做忘记了
css代码是这样的
body {
font-size: 12px; padding:0; margin:0; font-family:"宋体";
}
.c{ clear:both;}
.fl{ float:left;}
.fr{ float:right;}
.wi{ width:932px; margin:0 auto;}
ul,li,p{ padding:0; margin:0; list-style:none;}
img{ vertical-align:middle; border:0;}
a{ text-decoration:none; color:#333;}
a:hover{ text-decoration:underline;}

.top{ height:68px;}
.lg{ width:367px;}
.lgr{ width:493px; color:#ff6600; padding-top:27px; text-align:center; line-height:18px; height:18px;}
…………………………
就复制上面的一点吧,我想吧背景色设置成白色。
<style type="text/css">
<!--
body {
background-color: #FFFFFF;
}
-->
</style>
上面的这个代码添加到css中,加到什么位置。
我仅仅把
body {
background-color: #FFFFFF;
}
添加到css首行或者末尾都可以,但是不知道以后会有什么后果没有,毕竟忘记了太多了。
我加了后就有2个body了,去除body就没有效果了。

热心网友

css中的background属性
【具体操作】
(1)背景颜色
body{background-color:#fff; }
(2)背景图片
body{
background-image:url(111.jpg); //背景图片地址
background-position:0 0; //背景图片位置
background-repeat:no-repeat; //背景图片是否重复
}
以上可以简写成
body{ background:url(111.jpg) 0 0 no-repeat;}

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com