I want to center a background image. There is no div used, this is the CSS style:
body{
background-position:center;
background-image:url(../images/im
Try this background-position: center top;
This will do the trick for you.
if your not satisfied with the answers above then use this
* {margin: 0;padding: 0;}
html
{
height: 100%;
}
body
{
background-image: url("background.png");
background-repeat: no-repeat;
background-position: center center;
background-size: 80%;
}
The only thing that worked for me is..
margin: 0 auto
Had the same problem. Used display and margin properties and it worked.
.background-image {
background: url('yourimage.jpg') no-repeat;
display: block;
margin-left: auto;
margin-right: auto;
height: whateveryouwantpx;
width: whateveryouwantpx;
}
Try
background-position: center center;
I think this is what is wanted:
body
{
background-image:url('smiley.gif');
background-repeat:no-repeat;
background-attachment:fixed;
background-position:center;
}