Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Mani Saini
Mani Saini
3,101 Points

How does HTML structure works?

I want my <img> which is under class "images" to show underneath one of the class "intro". However image is showing on right hand side of one of the other class called "board". Can someone please explain how to use these div tags?

<html> <head> <meta charset="utf-8"> <title>My Site</title> <link rel = "stylesheet" href = "css/normalize.css"> <link rel = "stylesheet" href = "css/site.css"> </head> <body> <header>

  <h1 class = "main-heading group">GURUDWARA SRI DASHMESH DARBAR</h1>
    <!-- <div class = "image"><img src = "pic1.jpg"></div>
    <div class = "image1"><img src = "pic1.jpg"></div> -->

      <li><a href = "site.html"> Home</a></li>
      <li><a href = "site.html"> Sikhism</a></li>
      <li><a href = "site.html"> Events</a></li>
      <li><a href = "site.html"> Gallery</a></li>
      <li><a href = "site.html"> Langar</a></li>
      <li><a href = "site.html"> Member</a></li>
      <li><a href = "site.html">Constituion</a></li>
      <li><a href = "site.html"> History</a></li>
      <li><a href = "site.html"> Contact Us</a></li>


<div class  = "main">
    <div class= "board">

    <div class  = "intro">
      <p> Testing Intro</p>

    <div class  = "images">
      <img src = "goldentemple.jpg">

  <a href ="http://facebook.com/nickpettit"><img src = "facebook.png" alt = "Facebook Logo" class = "social-icon"></a>
  <p>&copy; 2016 Mani Saini.</p>

</body> </html>

2 Answers

David Montalvo
David Montalvo
6,937 Points

Hey there, have you tried with float property?, maybe that could help.

Ran ShemTov
Ran ShemTov
14,148 Points

This happens not because of HTML structure, but because of element properties on the CSS side. There is the display property in CSS and every element has it's display. a P element (as i recall) is not shown as "display: block" be default, meaning it will not span the entire document by default, pushing the image down.

In order to get this fixed you will have to use CSS and style your way into the outcome you want. If you're not familier with CSS, the treehouse teacher Guil Hernandez teaches here some great CSS in many courses.