0

嘿伙计们,我在设置导航样式时遇到问题,因此无论浏览器如何,它都将始终位于页面上的同一位置....

我有以下内容:

#Mainmenu {
    width: 44%;
    font-family: Helvetica, Arial, Sans-Serif;
    font-weight: bold;
    font-size: .9em;
    list-style: none;
    position: absolute;
    left: 35em;
    top: 4.7em;
    right: 0;   

}

这是定位,正是我想要它在 chrome 和 firefox 中但不是在 IE 中的位置。此外,如果我改变分辨率,它会稍微改变定位。我想知道我怎么能总是在它应该在的同一个地方拥有它。

需要帮助请叫我!

大卫

更新:

http://jsfiddle.net/MVPkP/ - 是我在其中的样式和布局。

这就是它在 IE 中的样子 它在 Chrome 中的外观

上面的一个是 Chrome,我希望它保持原样,这就是我想要的样式。

4

2 回答 2

2

把它放在你的标题中

 <!--[if IE]>
   <link rel="stylesheet" type="text/css" href="IE.css" />
 <![endif]-->

为 IE 创建一个额外的 css 文件并相应地调整您的 IE css。

于 2013-02-11T06:27:46.770 回答
0

您应该在左/右/上使用 %,或者将此元素放在另一个元素中。

例如:

#Mainmenu {
width: 44%;
font-family: Helvetica, Arial, Sans-Serif;
font-weight: bold;
font-size: .9em;
list-style: none;
position: absolute;
left: 3%;
top: 1.5%;
right: 0;   
}

至于把它放在另一个元素中:

#wrap{
width: 700px;
margin:0 auto;  
 }

<div class="wrap">
     your menu stuff...
</div>

其中任何一个都可以解决您的问题

于 2013-02-11T06:26:49.670 回答