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

Aligning text with image in same div

I’m having trouble figuring out how to perfectly align my text and image.

Examples:

enter image description here

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

enter image description here

enter image description here

Any help is appreciated!

.navbar .logo a {
  color: #ececec;
  font-size: 1.5rem;
  font-weight: 700;
}
.logo img {
  width: 30px;
}
<div class="logo">
    <img src="img/favicon/favicon.png" alt="">
    <a href="#">LABFOLD</a>
</div>

>Solution :

Use flex box to align them perfectly

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

.navbar .logo a {
  color: #ececec;
  font-size: 1.5rem;
  font-weight: 700;
}

.logo img {
  width: 30px;
}
<div class="logo">
  <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/b/b6/Image_created_with_a_mobile_phone.png/1280px-Image_created_with_a_mobile_phone.png" alt="">
  <a href="#">LABFOLD</a>
</div>
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