【发布时间】:2018-05-11 16:46:12
【问题描述】:
我有一个 Bootstrap 容器,其中一行由两列组成。
右侧的列包含一张图片,在屏幕尺寸低于中等大小时应该会消失。在中等尺寸及以上的屏幕尺寸下,它应该占用 7 个网格列。左侧的列在屏幕尺寸低于中等的屏幕尺寸下应占用网格的所有 12 列,在其他尺寸时占用 5 列。
不幸的是,我看到了一些不同的东西 - 两列垂直堆叠,并且右列在较小的屏幕尺寸下不会消失。我做错了什么?
(请忽略使用“className”而不是“class”,这是一个 React 项目,这是 React 约定。)
<div className="container-fluid h-100 w-100">
<div className="row d-flex flex-row justify-content-around align-items-center h-100">
<div className="col-xs-12 col-md-5 d-flex align-items-center justify-content-around h-100 float-right">
<div className="jumbotron">
<h6 className="display-6">Sorry to see you go!</h6>
</div>
</div>
<div className="backdrop col-md-7 d-none d-md-inline d-lg-inline d-xl-inline d-flex justify-content-around align-items-center h-100" />
</div>
</div>
【问题讨论】:
-
附注:你不应该需要
w-100和container-fluid。 -
谢谢,好提醒。关于如何解决布局问题的任何想法?
-
什么版本的 Bootstrap 4?看起来您需要简化和删除所有 util 类。为什么不直接使用
col-md-5和col-md-7? -
没有
col-xs你应该改用col。所以col-xs-12=col-12。
标签: twitter-bootstrap bootstrap-4 twitter-bootstrap-4