0

enter image description here

I want to center right div by parent width, but there is left div. Is it possible to do without JS or position: absolute? Just with flex.

.parent {
  width: 100%;
  display: flex;
  background: antiquewhite;
  height: 50px;
}

.left {
  flex-basis: auto;
  flex-shrink: 0;
  border: solid 2px red;
}

.right {
  display: flex;
  width: 100%;
  justify-content: center;
  border: solid 2px green;
}
<div class='parent'>
  <div class='left'>Text 123 Text 123 Text 123</div>  
  <div class='right'>Text 321 Text 321 Text 321</div>
</div>

0 Answers0