【发布时间】:2017-09-21 07:15:20
【问题描述】:
我想为 Bootstrap 行内的最高 div 应用边框。以下是我的代码(例如):
<section>
<div class="row">
<div class="col-md-6">
<strong><span style="color:#f77f00;">TIP 1:</span> blahblahblah</strong>
<p>dnijengeinjkdngkjdfnsdmnvjkgnkjnvjkerngeiuj <br/>orem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
</div>
<div class="col-md-6">
<div class="embed-responsive embed-responsive-16by9">
<iframe width="560" height="315" src="https://www.youtube.com/embed/4ZT2AXgGzAU?start=77" frameborder="0" allowfullscreen class="embed-reponsive-item"></iframe>
</div>
</div>
</div>
</section>
在某些情况下,Youtube 视频 DIV (class="col-md-6") 最高,而在其他情况下,文本 div (class="col-md-6") 最高。 (例如,当您在平板电脑上查看时)
确定最高 div 的最佳解决方案是什么,找出它在哪一侧(左/右)并向左或右应用边框(取决于它在哪一侧)?
如您所见,中间线并非一直到底部。我希望它一直到底部,我找到了解决方案:
section {
padding: 30px;
border: 1px solid gray;
margin-bottom: 45px;
}
section .row {
border: 1px solid gray;
}
section .row > div:last-of-type {
border-left: 1px solid gray;
}
section .row > div:only-child {
border-left: 0;
}
@media (max-width: 991px) {
section .row > div:last-of-type {
border-left: 0;
}
}
但这仅适用于右侧的 div 高于左侧的 div(如您在示例中所见)
如果我的问题不清楚或不完整,请告诉我。
编辑:为什么我的帖子被否决了?我不明白为什么。
【问题讨论】:
-
“最高 div”是什么意思?
-
我认为他们的意思是“最高”
-
你想要 Javascript/JQUERY/CSS 吗?
-
不知道如何设置边框..
-
.row div:first-child{ } 这很好吗?
标签: jquery html css twitter-bootstrap