简体   繁体   English

为什么该Bootstrap col删除空白?

[英]Why is this Bootstrap col removing white space?

I am trying to design a profile page ui, I want the profile name next to the avatar. 我正在尝试设计个人资料页面ui,我想要头像旁边的个人资料名称。 I am using bootstrap's grid system but getting white space in between each column. 我正在使用bootstrap的网格系统,但在每一列之间都留有空白。

例

This is the link: https://studentvend.co.uk/profile/test for those who want to see the source code. 这是链接: https : //studentvend.co.uk/profile/test,用于那些想要查看源代码的人。

It is normal because you are using a col of size 4 and col of size 6. So that basically means that it is going to take 40% of the card and then 60% of the card. 这是正常的,因为您使用的是大小为4的col和大小为6的col。因此,这基本上意味着它将占用卡的40%,然后再占用卡的60%。 It is not exact because Bootstrap is based on 12 columns . 这是不准确的,因为Bootstrap基于12列

I recommend you use a Media Object instead: https://getbootstrap.com/docs/4.0/layout/media-object/ 我建议您改用媒体对象https : //getbootstrap.com/docs/4.0/layout/media-object/

<div class="media">
  <img class="mr-3" src="..." alt="Generic placeholder image">
  <div class="media-body">
    <h5 class="mt-0">Media heading</h5>
    Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum nunc ac nisi vulputate fringilla. Donec lacinia congue felis in faucibus.
  </div>
</div>

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

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