css 菜单左对齐不会有 100% 的宽度

标签 css navigation cross-browser width

为什么我的 ul li 没有一直延伸到屏幕右侧?似乎不是 100%。请在提供的示例中提供帮助。导航栏在某些特定的调整大小时并没有完全延伸到屏幕上;我扩展浏览器窗口的次数越多,来自 UL 的最后一个 LI 子节点与浏览器边框右侧之间的差距就越大。当您悬停时,您可以看到它。 “注册”项...请帮助...

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  background-color: rgba(182, 182, 182, 1);
}
div.main_container {
  position: fixed;
  height: 100%;
  width: 100%;
  background-image: url("../images/IMG_0060.JPG");
  background-repeat: no-repeat;
  background-size: cover;
  background-attachment: fixed;
}
div.nav_container {
  position: fixed;
  z-index: 1;
  height: 50px;
  width: 100%;
  min-width: 700px;
  background-color: rgba(34, 34, 34, .75);
}
ul.nav {
  margin: 0;
  padding: 0;
  list-style: none;
  list-style-type: none;
  height: 50px;
  width: 100%;
}
ul.nav li {
  background-color: transparent;
  display: table;
  float: left;
  height: 50px;
  width: 14.285714286%;
  text-align: center;
}
ul.nav li marquee {
  position: relative;
  display: table-cell;
  vertical-align: middle;
  color: white;
  font-weight: bold;
  font-family: fantasy;
}
ul.nav li a {
  text-decoration: none;
  text-transform: capitalize;
  font-family: fantasy;
  position: relative;
  display: table-cell;
  vertical-align: middle;
  color: lightgray;
  font-weight: bold;
}
ul.nav li:hover {
  background-color: rgba(205, 205, 205, .50);
}
ul.nav li:hover marquee {
  background-color: black;
  color: lightgreen;
}
ul.nav li:hover a {
  color: black;
}
<div class="main_container">
  <div class="nav_container">
    <ul class="nav">
      <li>
        <a href="#">home</a>
      </li>
      <li>
        <a href="#">projects</a>
      </li>
      <li>
        <a href="#">social</a>
      </li>
      <li>
        <a href="#">tutorials</a>
      </li>
      <li>
        <marquee scrollamount="2">
          some sliding text
        </marquee>
      </li>
      <li>
        <a href="#">login</a>
      </li>
      <li>
        <a href="#">sign up</a>
      </li>
    </ul>
  </div>
</div>

最佳答案

简单添加

min-width with percentage like min-width:99.8% and min-width:14.2%

或其他什么,它会限制浏览器保持指定的最小宽度

关于css 菜单左对齐不会有 100% 的宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36054131/

相关文章:

html - 不规则图库 Bootstrap

javascript - Button 上的 Bootstrap 3 Popover 未正确关闭

Android 导航 Controller : How to solve saveBackStack must not contain retained fragment

java - Jetpack 导航上未执行导航操作

javascript - 如何点击外部关闭导航栏?

javascript - jQuery/Javascript : scrollTop Value in all browsers?

html - 如何使 Bootstrap 4 列高度相同?

html - 无论浏览器大小如何,如何让 <div> 始终位于浏览器窗口的右上角?

高度为 100% 的 HTML 布局

jquery - 选项卡菜单在 IE7,8 中不起作用