【发布时间】:2021-02-02 01:33:07
【问题描述】:
我希望我的 列 占据我的 容器 的整个宽度,我尝试了很多方法,但没有找到 解决方案如何解决它.
看到红色的小箭头了吗?这是我不想看到的空间。
HTML:
<div class="container">
<div class="row">
<div class="col ml-auto">
<div class="card card-body justify-content-center" style="height:150px">
<h5 class="card-title">Privacy & Security</h5>
<p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
</div>
</div>
<div class="col mr-auto">
<div class="card card-body justify-content-center" style="height:150px">
<h5 class="card-title">Privacy & Security</h5>
<p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
</div>
</div>
</div>
</section>
CSS:
.framework {
background: rgb(27,28,30);
background: linear-gradient(180deg, #1b1c1e 0%, #27262d 200%);
display:grid;
max-width:100%;
padding:30px 10px 30px 10px;
margin-top:0.5em;
height:100%;
margin-left: auto;
margin-right: auto;
.card {
background: #27262d;
border-radius:5px;
}
img {
width:50px;
height:auto;
display:block;
margin-left:auto;
margin-right:auto;
margin-top:15px;
}
}
CSS(移动版):
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@800&display=swap');
.framework {
.card-title {
font-family:'Open Sans',sans-serif;
font-weight:800;
font-size:14pt;
text-align:left;
text-transform:uppercase;
}
.card-text {
font-family:geomanist,sans-serif;
color:rgba(255, 255, 255, 0.377);
font-weight:400;
font-size:10pt;
letter-spacing:-0.1px;
line-height:15px;
text-align:left;
}
@media only screen and (max-width: 600px) {
.card-title {
font-size:11pt;
}
.card-text {
font-size:9pt;
}
}
}
编辑(2020 年 10 月 19 日 | 12:09 [布鲁塞尔])通过在同一 div 中的“.row”类旁边添加“.mx-md-n5”类来修复它,这并不完美,但它满足我
【问题讨论】:
-
您错过了将开始部分标记放在代码中
-
一种添加引导间距实用程序的简单方法getbootstrap.com/docs/4.5/utilities/spacing
-
可以真正看到你在哪里使用框架,但两边都有 10px 的填充。可能就是这样。
padding:30px 10px 30px 10px;
标签: html css twitter-bootstrap bootstrap-4