-1

I would like to achieve something like that

enter image description here

where each "COL" is a div . I would like to be able also to easily edit in the future the distance especially between COL2,3,4 .

Thanks.

spring00
  • 177
  • 1
  • 4
  • 13

2 Answers2

1

You can also use margin property on first child and gap on flex container.

<div class="list">
  <div class="list__item">COL1</div>
  <div class="list__item">COL2</div>
  <div class="list__item">COL3</div>
  <div class="list__item">COL4</div>
</div>
.list{
  display: flex;
  gap: 2rem;
  width: 80%;
  background-color: greenyellow;
}
.list__item{
  background-color: deepskyblue;
}
.list__item:first-child{
  margin: 0 auto 0 0;  
}
kosmonavta
  • 36
  • 2
0

You can play around with this

.flex {
  display: flex;
  justify-content: space-around;
  align-items: center;
}

.col {
  background-color: teal;
  min-width: 100px;
  height: 50px;
  border: 1px solid black;
  display: flex;
  align-items: center;
}

.col:nth-child(1) {
  width: 100%;
  background-color: red;
}
<div class="flex">
  <div class="col">Col1</div>
  <div class="col">Col2</div>
  <div class="col">Col3</div>
  <div class="col">Col4</div>
</div>
Charles Lavalard
  • 2,061
  • 6
  • 26