简体   繁体   English

在具有行 class 的分区内的列上放置边框

[英]Putting a border on columns inside a division with row class

This is what my code looks like:这就是我的代码的样子:

 <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet"/> <div class="container" style="padding-top: 50px;"> <div class="row"> <div class="border col-md-5 px-5 py-5"> Hi </div> <div class="border col-md-5 "> Hi </div> </div> </div>

I want to put a border that covers the only the columns with col-md-5 class.我想用 col-md-5 class 放置一个覆盖唯一列的边框。 I tried doing it by putting border (bootstrap) in div with row and container class.我尝试通过将边框(引导程序)放在带有行和容器 class 的 div 中来做到这一点。 The border when I put border in class in row was near acceptable but the problem in that was it was covering extra space after the two columns.当我将边框放在行中的 class 中时的边框几乎可以接受,但问题在于它在两列之后覆盖了额外的空间。 Please help me out.请帮帮我。

Bootstrap borders are "substractive" as well so you can remove left/right side of the border on the columns... Bootstrap 边框也是“减法” ,因此您可以删除列上边框的左/右侧...

<div class="container" style="padding-top: 50px;">
    <div class="row">
        <div class="border border-right-0 col-md-5 px-5 py-5"> Hi </div>
        <div class="border border-left-0 col-md-5 "> Hi </div>
    </div>
</div>

https://codeply.com/p/FC3sJALVVH https://codeply.com/p/FC3sJALVVH

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM