-2

when i want to set the background for my page, i coded like this code! But it's just quite close to be full , it still has a small " White BackGround " maybe only 5px or 7px on the right , left, top and bottom also :(

#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;
}
Xuandao
  • 33
  • 7

3 Answers3

0

Make sure that both the background div and whatever may be wrapping it has both margin and padding set to 0.

Andreas Eriksson
  • 8,687
  • 7
  • 44
  • 64
0

It should be because of default margin/padding added by browser.

So please add margin:0 and padding:0 as below

 #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;
}

else just

body {
  margin: 0;
  padding: 0;
}
mohamedrias
  • 17,260
  • 2
  • 33
  • 45
0

Try adding margin:0; padding:0; as below:

#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;
}
TheWebsiteGuy
  • 274
  • 1
  • 2
  • 12