Issue
I need to center my div #banner
, but its taking position:absolute
. Sometimes I make it with jQuery but now I need to make it with CSS. Any help please.
Solution
If you want to horizontally center an absolutely positioned div that has a fixed width do this:
div {
position:absolute;
margin:0 auto;
left:0; right:0;
}
In your case: FIDDLE (The pink is the #banner)
#banner {
width: 996px;
height: 150px;
position:absolute;
z-index:1000;
margin:0 auto;
left:0;right:0;
}
Answered By - Danield
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.