html - 删除我的 html Bootstrap 网页中无法理解的空格

标签 html twitter-bootstrap css twitter-bootstrap-3

我有以下使用 Twitter Bootsrap 3 的 CSS 和 HTML 代码:

.container {
    display:table;
    width: 100%;
    margin-top: -50px;
    padding: 50px 0 0 0; /*set left/right padding according to needs*/
    box-sizing: border-box;
}

/**/

.container-fluid{
    height:100%;
}

html,body,.container {
    height:100%;
}


body>.container-fluid,
.container {
    display:table;
    width: 100%;
    margin-top: -50px;
    padding: 50px 0 0 0; /*set left/right padding according to needs*/
    box-sizing: border-box;
}


.row {
    height: 100%;
    display: table-row;

}

.row .no-float {
    display: table-cell;
    float: none;
    vertical-align:top;
}
<body >

<div class="container-fluid" style=" ">
    <div class="row" >
    <div class="col-sm-12 col-md-7 col-lg-7 no-float" style="padding: 0 !important;border: solid blue ">


            <iframe src="http://exame.abril.com.br/tecnologia/facebook/noticias/facebook-nao-tem-planos-de-voltar-a-china-diz-executivo"  style="border: none;"></iframe>

        </div>
        <div class="col-sm-12 col-md-5 col-lg-5  no-float" style=" padding:0; border: solid red">
            <div class="panel panel-default" style="height: 100%!important; width: 100%!important;  ">
                <div class="panel-heading">QUESTIONS</div>
                <div class="panel-body">
                    HI


                </div>
            </div>

        </div>
</div>
</div>
</div>
</body>

当我运行它时,我得到了一些类似这样的东西,并且在列网格的顶部和底部有一些额外的空间:

enter image description here

虽然我认为我的 CSS 代码是正确的,但我几乎没有尝试删除那些额外的未知空间以使我的容器流体达到 100% 全高,同时当然保持相同的结构,但不能.

怎么了?请帮助我!

最佳答案

我删除了 margin: -50px; padding: 50px 0 0 0因为它是 margin: -50px导致底部间隙,我删除了你在 <body> 之后的杂散字符标签,造成顶部间隙。

此外,我清理了一些 CSS 并添加了一个 margin: 0html, body规则

html,
body,
.container-fluid {
  margin 0;
  height: 100%;
}
body > .container-fluid {
  display: table;
  width: 100%;
  box-sizing: border-box;
}
.row {
  height: 100%;
  display: table-row;
}
.row .no-float {
  display: table-cell;
  float: none;
  vertical-align: top;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />

<div class="container-fluid">
  <div class="row">
    <div class="col-sm-12 col-md-7 col-lg-7 no-float" style="padding: 0 !important;border: solid blue ">

      <iframe src="http://exame.abril.com.br/tecnologia/facebook/noticias/facebook-nao-tem-planos-de-voltar-a-china-diz-executivo" style="border: none;"></iframe>

    </div>
    <div class="col-sm-12 col-md-5 col-lg-5  no-float" style=" padding:0; border: solid red">
      <div class="panel panel-default" style="height: 100%!important; width: 100%!important;  ">
        <div class="panel-heading">QUESTIONS</div>
        <div class="panel-body">
          HI
        </div>
      </div>

    </div>
  </div>
</div>

关于html - 删除我的 html Bootstrap 网页中无法理解的空格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41194023/

相关文章:

Javascript/HTML 按钮点击错误

html - Bootstrap - 将高度设置为 Bootstrap 的列、行、容器等是一个好习惯吗?

php - 在 PHP dom 中编辑 html - 将 CSS 更改为 Img 属性

jquery - Twitter Typeahead 更新程序

jquery - 数据表分页使不可点击的链接变灰

javascript - 当图像 src 不为空时更改 css 类

html - 在表格行上滚动不平滑 - Windows Phone

html - 是否可以将函数内部循环中的变量值获取到全局变量中?

javascript - 从 URL JSON 检索数据

php - 带有标题 View 的 Angular ng-repeat