菜单栏在放大/缩小时无法正确显示

时间:2012-09-07 09:02:22

标签: html css

我有一个包含6个项目的菜单栏:

enter image description here

enter image description here

当我放大/缩小时,布局会发生变化:

为什么会发生这种情况?

CSS:

.menubar {
float:left;
width:920px;    
background:url(../images/nav-back.png) top left repeat-x;
height:52px;
    padding:9px 10px 8px 10px;
    margin-bottom:32px;
 }
.menubar ul {
   float:left;
   background:url(../images/nav-bg.gif) top left repeat-x;
   width:100%;
   display: block; 
}
.menubar li { float:left; background:url(../images/depth.gif) top right no-repeat;   }
.menubar li.last { background:none;  }
.menubar li.first a { padding:16px 42px 16px 43px; }
.menubar li.last a { padding: 16px 43px 16px 44px; }
.menubar li a { padding:16px 18px; display: block; }

2 个答案:

答案 0 :(得分:0)

这是因为代码的一部分在percents而另一部分是固定大小的。但由于你的问题中没有代码,我不能说如何改进它。

答案 1 :(得分:0)

正如@loler所说,这可能发生在固定大小的属性上。尝试使用em(或百分比)制作所有大小属性​​。这应该可以解决你的问题。 Em是相对值,具体取决于浏览器的字体大小。因此,如果您滚动进出该网站,看起来总是一样。

相关问题