Reputation: 1
How to display a div at center top position of the page, which need to be work under all size of monitors using CSS.
Mainly I get issues on IE, where not aligned properly.
Upvotes: 0
Views: 1166
Reputation: 20456
div#center { width: 300px; margin: 0px auto; }
not working on IE...
Upvotes: 0
Reputation: 3039
Are you comparing the rendering in both IE and another browser by switching back and forth? If so, you might be noticing a shift because of the scroll bar. IE reserves the space for the scrollbar, while browsers such as Firefox only show the window scroll when necessary.
Upvotes: 0
Reputation: 10422
For margin: 0px auto; to work width needs to be provided
style:
div#center
{
width: 300px;
margin: 0px auto;
}
html:
<div id="center">content</div>
Upvotes: 3