Search code examples
htmlcssalignment

Position 2 texts same height


Trying to position "Certamente não" and "Certamente Sim" at the same height.

Using margin top doesn't seem to align them correctly.

enter image description here enter image description here


Solution

  • You can use "flexbox" to align them. For example:

    .parent {
      display: flex;
      align-items: center;
    }
    
    <div class="parent">
      <span>Certamente não</span>
      <span>Certamente Sim</span>
    </div>
    

    Learn more about flexbox: https://css-tricks.com/snippets/css/a-guide-to-flexbox/