Align background image counting pixels from the center?
I realized the only way to get a background image properly aligned was counting pixels from the center, since using % and counting pixels from the left sometimes overlays images depending the screen size.
There must be a way to align it properly.
Is ther开发者_如何学编程e a way to align the background image horizontally counting pixels from the center?
Thanks
With CSS I would use something like this.
div.background{
position: absolute;
left: 50%;
margin-left: -100px;
}
The margin-left would be exactly half of the width of the background.
background-position:center top;
精彩评论