简体   繁体   English

如何防止导航栏在窗口调整大小时转移?

[英]how to keep navbar from shifting on window resize?

How can i keep everything on the page the way it is so when window is resized nothing moves and just a scroller appears. 如何将所有内容按原样保留在页面上,所以当调整窗口大小时,什么都不会移动,只会出现滚动条。 I am using twitter bootstrap. 我正在使用Twitter Bootstrap。

   <div class="container">
  <div class="text-center">
     <ul class="nav nav-pills" role="tablist">
      <li role="presentation" class="active"><a href="#">Home</a></li>
      <li role="presentation"><a href="#">TierList</a></li>
      <li role="presentation"><a href="#">Tournaments</a></li>
      <li role="presentation"><a href="#">Team Maker</a></li>
      <li role="presentation"><a href="#">Counters</a></li>
      <li role="presentation"><a href="#">Builds</a></li>          
      <li role="presentation"><a href="#">Forum</a></li>
      <li role="presentation"><a href="#">Contact Us</a></li>
    </ul>
  </div>

Just give .container element fixed width: 只要给.container元素固定宽度:

.container {
    width: 900px;
}

Demo: http://plnkr.co/edit/3QLf5ThO7lwLdfQQCbuH?p=preview 演示: http : //plnkr.co/edit/3QLf5ThO7lwLdfQQCbuH?p=preview

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM