开发者

how to display a div at center top of the page

开发者 https://www.devze.com 2022-12-16 15:29 出处:网络
How to display a div at center top position of the page, which need to be work under all size of monitors using CSS开发者_运维问答.

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

精彩评论

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