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 do i put blocks of text next to each other in HTML?

I’m making a personal website for fun and practice and i would like to have some blocks of text be next to each other so they align with the sides of the page horizontally but they’re on the same level vertically. Each block has its own header so it’s able to be distinguished from the other ones. I’m open to using HTML and/or CSS for this.

>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

There are numerous ways of doing this with HTML and CSS, but for a beginner I would recommend looking at adding the display: inline-block css property to wrapper elements around the content. For example,

section {
  display: inline-block;
}
<body>
  <section>
    <h3>Hello</h3>
    <p>World</p>
  </section>
  <section>
    <h3>Hello</h3>
    <p>Pluto</p>    
  </section>
</body>

You can also look into Flexbox and CSS Grid in the future, but they are more complicated to get your head around when starting out. Good luck!

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