css - 如何避免列间隙空间 - 边距和填充设置为 0 不起作用

标签 css html twitter-bootstrap-3

当我尝试在 firefox 中打开简单的测试 html 时,一切都很好,但是在 Chrome 或移动设备上打开它时,我在列之间出现白色间隙。 有谁知道为什么?

如果您知道如何解决这个问题,我将不胜感激。问题是,它与 Firefox 配合得很好,但是 Chrome 和移动设备无法将其识别为没有任何间隙的对象。

enter image description here

<div class="container">
    <div class="col-md-4 col-xs-4" style="  padding:0 !important;
  margin:0 !important;
  border:1px solid;
">
        <div class="col-md-1 col-xs-1" style="  padding:0 !important;
  margin:0 !important;
">
            <button id="11" class="button" type="button" style="  background-color:green;
  height:40px;
  width:100%;
  border:none;
  display:flexbox;
  padding:0 !important;
  margin:0 !important;
"></button>
        </div>
        <div class="col-md-10 col-xs-10" style="  padding:0 !important;
  margin:0 !important;
">
            <button id="12" class="button" type="button" style="  background-color:green;
  height:40px;
  width:100%;
  border:none;
  display:flexbox;
  padding:0 !important;
  margin:0 !important;
"></button>
        </div>
        <div class="col-md-1 col-xs-1" style="  padding:0 !important;
  margin:0 !important;
">
            <button id="13" class="button" type="button" style="  background-color:green;
  height:40px;
  width:100%;
  border:none;
  display:flexbox;
  padding:0 !important;
  margin:0 !important;
"></button>
        </div>
        <div class="col-md-1 col-xs-1" style="  padding:0 !important;
  margin:0 !important;
">
            <button id="14" class="button" type="button" style="  background-color:green;
  height:160px;
  width:100%;
  border:none;
  display:flexbox;
  padding:0 !important;
  margin:0 !important;
"></button>
        </div>
        <div class="col-md-10 col-xs-10" style="  padding:0 !important;
  margin:0 !important;
">
            <button id="15" class="button" type="button" style="  background-color:greeen;
  height:160px;
  width:100%;
  border:none;
  display:flexbox;
  padding:0 !important;
  margin:0 !important;
"></button>
        </div>
        <div class="col-md-1 col-xs-1" style="  padding:0 !important;
  margin:0 !important;
">
            <button id="16" class="button" type="button" style="  background-color:green;
  height:160px;
  width:100%;
  border:none;
  display:flexbox;
  padding:0 !important;
  margin:0 !important;
"></button>
        </div>
        <div class="col-md-1 col-xs-1" style="  padding:0 !important;
  margin:0 !important;
">
            <button id="17" class="button" type="button" style="  background-color:green;
  height:40px;
  width:100%;
  border:none;
  display:flexbox;
  padding:0 !important;
  margin:0 !important;
"></button>
        </div>
        <div class="col-md-10 col-xs-10" style="  padding:0 !important;
  margin:0 !important;
">
            <button id="18" class="button" type="button" style="  background-color:green;
  height:40px;
  width:100%;
  border:none;
  display:flexbox;
  padding:0 !important;
  margin:0 !important;
"></button>
        </div>
        <div class="col-md-1 col-xs-1" style="  padding:0 !important;
  margin:0 !important;
">
            <button id="19" class="button" type="button" style="  background-color:green;
  height:40px;
  width:100%;
  border:none;
  display:flexbox;
  padding:0 !important;
  margin:0 !important;
"></button>
        </div>
    </div>
</div>

最佳答案

按钮是原生的内联元素。因此,就像句子中的单词一样,它们的右侧和下方都有空格。

要轻松解决此问题,您只需使用 display: block;

设置按钮样式

顺便说一句,没有 display: flexbox; 我想你在想 flex 但这无论如何都行不通,因为 display: flex ; 将用于包含由其所有子项组成的 flex 内容的容器。

关于css - 如何避免列间隙空间 - 边距和填充设置为 0 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41271053/

相关文章:

javascript - 使用javascript淡出幻灯片

javascript - Bootstrap 中是否有类似于弹出窗口的内容,即使弹出窗口被阻止,它仍会播放?

javascript - Android 上的手机唤醒后 HTML5 GPS 地理定位失败

jquery - 有没有更好的方法在 Twitter Bootstrap 中显示事件选项卡?

css - 如何让大众字体停止增长

javascript - "Vertical accordian"使用 HTML5/CSS3 设计?

php - 想要使用 html 表单字段将页面 url 存储到 mysql

javascript - 将xml嵌套到jquery中的无序列表中

css - 词缀破坏了 bootstrap 的嵌套网格

css - Bootstrap 3 流体网格布局问题?