【发布时间】:2018-03-26 06:59:59
【问题描述】:
我尝试使用 flex,但列高仍然不一样,并且在 w3schools 和 medium 中提到了一些方法,但没有用。第一次使用 flex 方法有效,但是当我再次刷新时它消失了,我不明白为什么会发生这种情况。
这段代码有什么问题吗?请帮帮我。
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
<title>Bootstrap Page</title>
<style>
p{
background:rgba(25,105,25,0.4);
color:white;
}
.row{
display: flex;
flex-wrap: wrap;
}
.row > .col-md-6 {
display: flex;
flex-direction: column;
}
</style>
</head>
<body>
<div class="container">
<div class="row display-flex">
<div class="col-md-6 para1">
<div>
<p>M. Best who informed him that locomotives
could be obtained at a railroad boneyard in Mérida, Yucatán, Mexico, owned by the Ferrocarriles Unidos de Y
ucatán..</p>
</div>
</div>
<div class="col-md-6 para1">
<div>
<p> Best who informed him that locomotives
could be obtained at a railroad boneyard in mer, went to Mérida in 1969 to investigate.The development er, went to Mérida in 1969 to investigate.The developme
nt of the Walt Disney World Railroad from the late 1960s to its opening in 1971 was overseen by Roger E. Broggie,
vice president and general manager of Mapo, Inc</p>
</div>
</div>
</div>
</div>
</body>
【问题讨论】:
-
列宽还是列高?您的问题标题同时提及,而您的问题正文均未提及。
-
您肯定缺少
p元素的样式声明的结束标记... -
列高和'p'没有结束标签没有丢失.....
-
实际上这个截图是在删除一些应用于段落的样式之前拍摄的。这就是为什么缺少“p”结束标签的原因。但是问题仍然存在。
-
只需在内部 div 上使用
h-100类或<p>。你不需要所有额外的 flexbox 东西。 codeply.com/go/5msONxe8fg
标签: html css flexbox bootstrap-4