简体   繁体   中英

how to horizontally align kitchen sink cards in bootstrap?

I am trying to align me kitchen sink cards horizontally here is a picture of the cards.

( https://i.stack.imgur.com/4JIXc.png )

These cards ⬆️ are not aligned horizontally as you see I want them aligned horizontally I tried many CSS & HTML codes but none worked.

This is one line of code I tried:

CSS: float:left;clear:none;

you can use a css property called display: flex; i that the default flex direction is row is already enabled. so you can use this property for your cards main root element.

You can use:-

display: flex;
justify-content: center;

on parent element, to horizontally centered the item. There are other values also for justify-content which you can use to align as you want.

In bootstrap, you can simply use classes:-

d-flex justify-content-center

on parent element, to horizontally centered the item. Similarly there are other classes also. You can see bootstrap docs.

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