D
D
di2020-07-02 10:32:22
css
di, 2020-07-02 10:32:22

How to add margin between cards without breaking layout?

How to add margin between cards without breaking layout? I want it to be like this
5efd8cc95bebd686119087.png

And it turns out like this
5efd8d0547599303859415.png

Example in the sandbox
https://codepen.io/delgus/pen/wvMqvER

The code

<div class="container">
    <div class="row">
      <div class="my-class col-4 card">
        <div>
          Test
          suifyuwiygfuisygusdifyg
          weiurwoeurwoeur
          ewoiruwoeurioweruowei
          weioruweoruoweiru
        </div>
      </div>
      <div class="my-class col-4 card">
        <div>
          Test
          suifyuwiygfuisygusdifyg
          weiurwoeurwoeur
          ewoiruwoeurioweruowei
          weioruweoruoweiru
        </div>
      </div>
      <div class="my-class col-4">
        <div>
          Test
          suifyuwiygfuisygusdifyg
          weiurwoeurwoeur
          ewoiruwoeurioweruowei
          weioruweoruoweiru
        </div>
      </div>
</div>



help me please

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Stalker_RED, 2020-07-02
@Delgus

margin: 5px;

O
Oleg Veshchin, 2020-07-02
@madolu2

If you are interested in a Bootstrap solution, then this is the class m(argin)
m - indents on all sides
mt - top
ml - left
mr - right
mb -bottom
example mt-(a number from 1 to 5)

J
Just Me, 2020-07-02
@Just__Den

never put extra styles on the grid where the .col is

<div class="container">
    <div class="row">
      <div class="col-4 px-3">
        <div class="card my-class">
          Test
          suifyuwiygfuisygusdifyg
          weiurwoeurwoeur
          ewoiruwoeurioweruowei
          weioruweoruoweiru
        </div>
      </div>
      <div class="col-4 px-3">
        <div class="card my-class">
          Test
          suifyuwiygfuisygusdifyg
          weiurwoeurwoeur
          ewoiruwoeurioweruowei
          weioruweoruoweiru
        </div>
      </div>
      <div class="col-4  px-3">
        <div class="card my-class">
          Test
          suifyuwiygfuisygusdifyg
          weiurwoeurwoeur
          ewoiruwoeurioweruowei
          weioruweoruoweiru
        </div>
      </div>
</div>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question