IE7 display issues (adding extra top margin)

删除回忆录丶 提交于 2019-12-02 08:08:03

I do this to every page:

<body>
<!--[if IE]><div class="ie"><![endif]-->

...LALALA

<!--[if IE]></div><![endif]-->
</body>

It's called a conditional comment. It's IE proprietary, but acts like a comment to other browsers and validators.

Now you can specify IE specific rules using .ie ancestor.

get some .ie #whatever{position:relative;} going on and put those boxes where they're supposed to be!

Not sure but try this out in your CSS do

body
{
    padding:0;
    margin:0;
}

http://www.w3schools.com/css/css_margin.asp http://www.w3schools.com/css/css_padding.asp

alternatively would like to see some code as posted by others.

use:

display: inline;

Hope this helps.

Try removing margin-top: from #background and instead add a clear:both or clear:right for #background.

Generally speaking, especially for IE7, but for better practice anyway, always specify all sides w/padding or margin...in other words don't just use margin-top:?px (? for whatever) and assume the rest is fine. Better to use margin:?px 0 0 0 or whatever values.

Another general idea, especially with IE 7 and below is to not use margin and padding on the same element.

Also, anything floated needs a width and as to the double-margin bug, it only occurs when you have margin on the same side as the side the element is floated.....so if you're declaring float:right on something, you don't want to have margin: 0 20px 0 0 on the same thing... it will get doubled. Better to use padding on the containing element.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!