html - IE 7/8 忽略绝对定位 DIV 之外的相对定位 DIV

标签 html css internet-explorer css-position

好的,我们开始吧……这是我的 HTML 代码:

<div id="header">
    <div class="menu-hauptmenu-container">
        <div id="logo">
        <a href="#"></a>
        </div>
    </div>
</div>

CSS:

.menu-hauptmenu-container {
position:relative;
max-width:960px;
width:90%;
margin-left:auto; 
margin-right:auto;
height:75px;
}
#header {
position:relative;
width:100%;
background:#eb3d3c;
height:75px;
}
#logo {
    position:absolute;
    width:200px;
    height:106px;
    background: url(img/logo.png) no-repeat center;
    top:0;
    left:5px;
    z-index:9999;
}
    #logo a{
        position:absolute;
        width:100%;
        height:100%;
        top:0;
        left:0;
    }

问题:IE7/8 忽略相对定位的“.menu-hauptmenu-container”,因此绝对定位的“#logo”定位在父 DIV 之外。

一如既往,我很难用英语解释技术上的想法,所以:

我知道,这不会很受欢迎,但这是现场直播的网站: http://www.thorstenbreyer.de/kunden/pommerel/tcn/ieproblem/

谢谢!

最佳答案

.menu-hauptmenu-container 在媒体查询中。 IE 7 和 8 忽略媒体查询,因此它的位置不正确。

关于html - IE 7/8 忽略绝对定位 DIV 之外的相对定位 DIV,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17164995/

相关文章:

javascript - div 的颜色变化太快

html - 如何水平居中元素?

html - 如何在输入标签中设置 Font Awesome 图标

jquery - IE jQuery 对象不支持属性trim()

css - Internet Explorer 的样式问题 - 最有可能的简单解决方案

html - CSS Sprite 下面的空白区域

jquery - 选择除 Jquery 中 ID 的某个元素之外的所有内容

javascript - 在我的案例中如何获取复选框值

javascript - 扩展搜索栏在关闭并重新打开后不搜索,Jquery

javascript - 基于IE文档方式加载css样式表