开发者

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...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜