简体   繁体   English

引导导航药丸之间有额外的空白

[英]Bootstrap navigation pills have extra white space between them

This is a simple bootstrap code I am trying, where the floated block elements have extra space between them. 这是我正在尝试的简单引导程序代码,其中浮动的块元素之间具有额外的空间。 How do I remove it, and why is it there ? 我如何将其删除,为什么在其中?

<ul class="nav nav-pills">
  <li style="width: 40%; background: #8ac1dc;" class="active">
    <a href="#ap-about" data-toggle="tab" aria-expanded="true">About</a>
  </li>
  <li style="width: 40%; background: #ff6666">
    <a href="#ap-personal" data-toggle="tab">Account</a>
  </li>
</ul>

Jsfiddle 杰斯菲德尔

Try this:- 尝试这个:-

 <ul class="nav nav-pills">
   <li style="width: 40%; background: #8ac1dc;" class="active">
    <a href="#ap-about" data-toggle="tab" aria-expanded="true" style="border-radius: 0;">About</a>
  </li>
 <!--  -->
 <li style="width: 40%; background: #ff6666;margin:0">
  <a href="#ap-personal" data-toggle="tab" style="border-radius: 0;">Account</a>
 </li>
</ul>

Remove margin 删除保证金

CSS 的CSS

.nav-pills>li+li{
    margin:0px;
}

Go to your bootstrap.css file on line 4093 and edit 2px to 0 转到第4093行的bootstrap.css文件,并将2px修改为0

.nav-pills > li + li {
  margin-left: 0;
}
Update the bootstrap.css margin-left from 2px to 0px 
.nav-pills > li + li {
  margin-left: 0px;
}

Add your custom class in ul like my-nav-pills my-nav-pills一样在ul中添加自定义类

and add css like below 并添加如下的css

.my-nav-pills li{
    margin-left:0px;
}

it is batter to overwrite the bootstrap class and dont change the css of default bootstrap class. 最好是覆盖bootstrap类,并且不要更改默认bootstrap类的css。

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

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