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

Html text and image side by side

This is a piece of my code I would like to know how to put an image and paragraph side by side.

    <section class="contact-section" id="contact">
    <div class="container">
         <h1>All About Us</h1>
         <hr>
         <img src="hpbanner.webp" width="600" height="750">
         <p>text here</p>
    </div>

>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

You can wrap img and p in a div, and make it a flexbox.

.flex-class {
  display: flex;
  flex-direction: row;  /* this is optional because row is default*/
  align-items: center;  /* this is if you want to align items vertically in the center */
}
<section class="contact-section" id="contact">
  <div class="container">
    <h1>All About Us</h1>
    <hr>
    <div class="flex-class">
      <img src="hpbanner.webp" width="600" height="750">
      <p>text here</p>
    </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