如何在HTML中设置页面的真实背景
当我想为我的页面设置背景时,我像这样编码!但它几乎要满了,它仍然有一个小的“白色背景”,可能在右边、左边、顶部和底部只有5px或7px如何在HTML中设置页面的真实背景,html,css,Html,Css,当我想为我的页面设置背景时,我像这样编码!但它几乎要满了,它仍然有一个小的“白色背景”,可能在右边、左边、顶部和底部只有5px或7px 确保background div和任何可能包装它的内容都将边距和填充设置为0。这应该是因为浏览器添加了默认边距/填充 因此,请添加margin:0和padding:0,如下所示 #background{ background-image: url('picture/background.jpg') ; background-repeat: no
确保background div和任何可能包装它的内容都将边距和填充设置为0。这应该是因为浏览器添加了默认边距/填充 因此,请添加
margin:0
和padding:0
,如下所示
#background{
background-image: url('picture/background.jpg') ;
background-repeat: no-repeat;
width : 100%;
height : 100%;
background-size : cover;
background-attachment: fixed;
top : 0px;
left : 0px;
margin: 0;
padding: 0;
}
否则就
body {
margin: 0;
padding: 0;
}
尝试添加
边距:0;
填充:0;
,如下所示:
#background{8
background-image: url('picture/background.jpg') ;
background-repeat: no-repeat;
width : 100%;
height : 100%;
background-size : cover;
background-attachment: fixed;
top : 0px;
left : 0px;
margin: 0;
padding: 0;
}
body{margin:0;padding:0}
?我知道了!非常感谢:)不客气。我想你可以接受这个答案;)
#background{8
background-image: url('picture/background.jpg') ;
background-repeat: no-repeat;
width : 100%;
height : 100%;
background-size : cover;
background-attachment: fixed;
top : 0px;
left : 0px;
margin: 0;
padding: 0;
}