固定菜单左对齐

时间:2014-08-01 08:18:36

标签: html css menubar

我正在处理this site。我在页面顶部设置了一个固定菜单,以便用户可以随时查看菜单而无需滚动。

我已将css添加到菜单类,如下所示,以减小宽度。

#masthead { 
margin: 0 auto;
width: 86%;
}

现在,当向左向下滚动时,我正在获得固定菜单。我尝试添加

#masthead.fixed-header
{    margin: 0 auto;
width: 86%;
}

但这似乎没有工作。任何人请帮助使其成为页面的中心。谢谢你!

1 个答案:

答案 0 :(得分:1)

enter image description here

只需在您的css

中将right: 0; left: 0;添加到#masthead.fixed-header(第649行)

它看起来像

#masthead.fixed-header {
   position: fixed;
   top: 0;
   right: 0;
   left: 0;
   min-height: 35px;
   box-shadow: 0 0 7px rgba(0, 0, 0, 0.1);
  -moz-box-shadow: 0 0 7px rgba(0, 0, 0, 0.1);
  -webkit-box-shadow: 0 0 7px rgba(0, 0, 0, 0.1);
}