简体   繁体   中英

middle center div in bootstrap

Hello guys I am trying to center 3 divs in bootstrap but I wasn't successful.

The only time when it worked was only when I used 3 <div class="col-md-4"> but I wanna do a 3 div of col-md-3 and center them horizontal.

After doing some research the only solution that I fond was to use col-md-offset but it doesn't center my div properly. The right space is bigger then the left one.

Here is my code and thanks for the help:

<div class="container">
<div class="col-md-3 col-md-offset-2">
</div>
<div class="col-md-3">
</div>
<div class="col-md-3">
</div>

If there is any other alternative that I can use rather then using bootstrap please share it with me, I would also prefer to see a working example on how to center 3 divs horizontal in the middle of the page.

thanks for the help

您可以简单地将它们添加到另一个div内,然后为该div使用display:inline-block,这将使其宽度变小,因此只有那些3 col-md-3适合,然后使用文本中心类在其上使用居中对齐包装的div亲

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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