how to display a div at center top of the page
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.
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>
CSS
div { margin : 0px auto; }
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.
div#center { width: 300px; margin: 0px auto; }
not working on IE...
精彩评论