0

.cnt {
  display: flex;
}

.one {
  background: #ff0000;
  width: 300px;
}

.two {
  background: #00ff00;
  flex: 1;
}
<div class="cnt">
  <div class="one">
    Center me
  </div>
  <div class="two">
    And me
  </div>
</div>

Is there actually a way? Of course I may add another div inside and set it as I like, but I want it to be more elegant... so, is that actually possible to align this text horizontally, at least, without using another divs?

https://jsfiddle.net/cwfs3b0x/

Michael Benjamin
  • 346,931
  • 104
  • 581
  • 701
mizzo
  • 97
  • 2
  • 7

1 Answers1

0

Unless I misunderstand you, this is just:

div {text-align: center}
mayersdesign
  • 5,062
  • 4
  • 35
  • 47