【问题标题】:fixed menu aligned to left固定菜单左对齐
【发布时间】:2014-08-01 08:18:35
【问题描述】:

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

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

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

现在我在向下滚动时得到了固定菜单。我尝试添加

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

但这似乎不起作用。任何人都可以帮助使其成为页面中心。谢谢!

【问题讨论】:

  • 当我滚动时看不到它:S
  • cener 标签已弃用。不是吗?

标签: html css menubar


【解决方案1】:

只需在您的 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);
}

【讨论】:

  • 我还建议您也添加一个width: 100%;。那看起来不错。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-03-08
  • 1970-01-01
  • 1970-01-01
  • 2016-02-17
  • 2017-05-25
  • 1970-01-01
相关资源
最近更新 更多