Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to display items aligned?

this is for sure a common question but text-align and display properties are not solving it, so i must have some mistake.
What should i do to display the 3 items in the same horizontal line?

.contact__information {
  vertical-align: middle;
  margin-bottom: var(--mb-1);
  padding-right: var(--mb-.75);
  align-items: right;
  text-align: center;
  display: inline-flex;
  margin-left: auto;
  margin-right: auto;
}
<section class="contact section" id="contact">
  <h2 class="section__title">Contacte</h2>
  <span class="section__subtitle">Contacte para mais informações</span>

  <div class="contact__information">
    <i class="uil uil-phone contact__icon"></i>
    <div>
      <h3 class="contact__title">Telemóvel</h3>
      <span class="contact__subtitle">999-777-666</span>
    </div>
  </div>

  <div class="contact__information">
    <i class="uil uil-envelope contact__icon"></i>
    <div>
      <h3 class="contact__title">Email</h3>
      <span class="contact__subtitle">email.com</span>
    </div>
  </div>

  <div class="contact__information">
    <i class="uil uil-map-marker contact__icon"></i>
    <div>
      <h3 class="contact__title">Morada</h3>
      <span class="contact__subtitle">Portugal</span>
    </div>
  </div>
</section>

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Step 1: Define width
Step 2: Locate parent to flex – #contact
Step 3: align-items: center; makes all elements inline (aligned)
Step 4: justify-content: space-evenly; spaces all elements evenly. Using up extra space.

#contact {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-evenly;
}
<section class="contact section" id="contact">
  <h2 class="section__title">Contacte</h2>
  <span class="section__subtitle">Contacte para mais informações</span>

  <div class="contact__information">
    <i class="uil uil-phone contact__icon"></i>
    <div>
      <h3 class="contact__title">Telemóvel</h3>
      <span class="contact__subtitle">999-777-666</span>
    </div>
  </div>

  <div class="contact__information">
    <i class="uil uil-envelope contact__icon"></i>
    <div>
      <h3 class="contact__title">Email</h3>
      <span class="contact__subtitle">email.com</span>
    </div>
  </div>

  <div class="contact__information">
    <i class="uil uil-map-marker contact__icon"></i>
    <div>
      <h3 class="contact__title">Morada</h3>
      <span class="contact__subtitle">Portugal</span>
    </div>
  </div>
</section>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading