background 命令做背景问题

来源:百度知道 编辑:UC知道 时间:2024/05/26 06:59:08
我写了一段网页背景代码 但是只能显示出来一部分 我的电脑分辨率是1440*900 背景图片也用这么大的 他只能显示出来部分 或者高度只能显示一半 img/c4.jpg是图片路径 代码如下

body {
background: url(img/c4.jpg);
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
</style>
</head>
<body>

在这里加怎么代码可以让背景图片拉伸 麻烦好心人帮忙写一下。

body{background:url(图片) repeat}

背景{}中添加background: url(图片地址)repeat
详细讲解:
repeat 背景图像在纵向和横向上平铺
no-repeat 背景图像不平铺
repeat-x 背景图像在横向上平铺
repeat-y 背景图像在纵向平铺

代码如下:
默认代码为:body{background-color:#FFFFFF}
换成以下代码
body{background:url(背景图片地址) background-position: center;background-attachment: fixed;repeat-x #FFFFFF}
这是全屏的背景代码~