gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-28 17:23:45 25 4
gpt4 key购买 nike

我有以下使用 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com