twitter-bootstrap - 为什么升级到 Bootstrap 4 后我的列表现不同?
问题描述
如果我在引导程序 3 中执行以下操作,那么一切都会按预期工作。但它在引导程序 4 中没有正确中断。请执行下面的示例,首先使用 BS4 运行,然后最后使用 BS3。
我希望它看起来像Bootstrap 3.3.6。
#orange_containers .row div {
background: orange;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
<div id="orange_containers" class="">
<div class="row no-gutters">
<div class="col-sm-6">
<div class="col-sm-3">
<div class="icon">
A
</div>
</div>
<div class="col-sm-9">
<div class="text">
<h4>Test</h4>
<p>
I'm speaking with myself, number one, because I have a very good brain and I've said a lot of things. If Trump Ipsum weren’t my own words, perhaps I’d be dating it.
</p>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="col-sm-3">
<div class="icon">
B
</div>
</div>
<div class="col-sm-9">
<div class="text">
<h4>Test</h4>
<p>
The other thing with Lorem Ipsum is that you have to take out its family. We have so many things that we have to do better... and certainly ipsum is one of them. We are going to make placeholder text great again. Greater than ever before.
</p>
</div>
</div>
</div>
</div>
</div>
引导程序 4
#orange_containers .row div {
background: orange;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" />
<div id="orange_containers" class="">
<div class="row no-gutters">
<div class="col-sm-6">
<div class="col-sm-3">
<div class="icon">
A
</div>
</div>
<div class="col-sm-9">
<div class="text">
<h4>Test</h4>
<p>
I'm speaking with myself, number one, because I have a very good brain and I've said a lot of things. If Trump Ipsum weren’t my own words, perhaps I’d be dating it.
</p>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="col-sm-3">
<div class="icon">
B
</div>
</div>
<div class="col-sm-9">
<div class="text">
<h4>Test</h4>
<p>
The other thing with Lorem Ipsum is that you have to take out its family. We have so many things that we have to do better... and certainly ipsum is one of them. We are going to make placeholder text great again. Greater than ever before.
</p>
</div>
</div>
</div>
</div>
</div>
注意:您必须全屏查看结果。
解决方案
我认为您需要添加一个容器和一些行。此外,您不能将 col 作为另一个 col 的子级,它必须在一行内。有关详细信息,请参见此处:https ://getbootstrap.com/docs/4.4/layout/grid/#nesting
尝试将您的代码更改为以下内容:
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" />
<div id="orange_containers" class="">
<div class="container-fluid">
<div class="row no-gutters">
<div class="col-sm-6">
<div class="row">
<div class="col-sm-3">
<div class="icon">
A
</div>
</div>
<div class="col-sm-9">
<div class="text">
<h4>Test</h4>
<p>
I'm speaking with myself, number one, because I have a very good brain and I've said a lot of things. If Trump Ipsum weren’t my own words, perhaps I’d be dating it.
</p>
/div>
</div>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="row">
<div class="col-sm-3">
<div class="icon">
B
</div>
</div>
<div class="col-sm-9">
<div class="text">
<h4>Test</h4>
<p>
The other thing with Lorem Ipsum is that you have to take out its family. We have so many things that we have to do better... and certainly ipsum is one of them. We are going to make placeholder text great again. Greater than ever before.
</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
推荐阅读
- spring-boot - 在百里香模板中显示值
- animation - 如何在 Kotlin 中为 Kotlin 中的场景动画调试“java.lang.NoSuchMethodError”?
- python - 在 Cython 中使用 C++ 的`str.erase()`
- highcharts - 在同一页面中显示多个图表
- javascript - 如何在画布面料JS上绘制线条动画
- python - 无法在 tensorflow-gpu 上使用 GPU:“无法创建 cudnn 句柄:CUDNN_STATUS_INTERNAL_ERROR”
- c# - 我可以在另一个线程上放一个取消按钮吗?
- json - 如何在后端从 JSON 读取数组
- angular - ng-bootstrap 下拉位置不适用于 Angular 7
- wordpress - Apache2 设置多个站点,子域不起作用?