在整个html文档中获得一致的完整背景';身体
我试图给我的页面提供一个完整的背景,但没有任何效果,我得到的输出是垃圾 我已经试过了我能想到的一切,但没有一件事是对的。你能告诉我我的错在哪里吗?(.jpg位于正确的位置)在整个html文档中获得一致的完整背景';身体,html,css,background-image,Html,Css,Background Image,我试图给我的页面提供一个完整的背景,但没有任何效果,我得到的输出是垃圾 我已经试过了我能想到的一切,但没有一件事是对的。你能告诉我我的错在哪里吗?(.jpg位于正确的位置) 身体{ 高度:100px; 宽度:100px; 背景图片:url(background.jpg)重复固定100%100%; } #容器{ 宽度:979px; 身高:100%; 保证金:0自动; 背景颜色:蓝色; } 白皮书 只是打个招呼 这是一个测试 我认为图像不存在或图像路径不正确 或者试试这个
身体{
高度:100px;
宽度:100px;
背景图片:url(background.jpg)重复固定100%100%;
}
#容器{
宽度:979px;
身高:100%;
保证金:0自动;
背景颜色:蓝色;
}
白皮书
只是打个招呼
这是一个测试
我认为图像不存在或图像路径不正确
或者试试这个
background-image:url('background.jpg');
这句话就够了你的图像能显示但不能填满所有需要的区域吗?如果是这样的话,试着在你的身体部位使用这个示例代码,看看它是否有效
body {
background: url(background.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
在背景图像中,删除图像,只放置背景,背景位置为中间顶部
body {
height: 100px;
width: 100px;
background:url(background.jpg) no-repeat fixed center top;
}
使用下面的代码
body {
background:url(your image path) repeat fixed 100% 100%;
background-attachment:fixed;
background-size:100%;
background:url(your image path) repeat fixed center center \9;
/*IE 9*/
background:url(your image path) repeat fixed top 100% /IE9;
background-attachment:fixed /IE9;
background-size:100% /IE9;
}如果您同意,请使用基本
css代码
应用背景图像
而不是这些
body {
height: 100px;
width: 100px;
background-image:url(background.jpg) no-repeat fixed 100% 100%;
}
试试这个
body {
height: 100px;
width: 100px;
background-image:url(background.jpg);
background-repeat:no-repeat;
background-position:fixed;
background-size:100%;
}
工作
body {
height: 100px;
width: 100px;
background-image:url(background.jpg);
background-repeat:no-repeat;
background-position:fixed;
background-size:100%;
}