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! While you're at it, check out some resources Treehouse students have shared here.

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

HTML

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> -->

<nav>
    <ul>
      <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>

    </ul>
  </nav>
</header>

<div class  = "main">
  <section>
    <div class= "board">
      <marquee direction="up">OPENING CEREMONY OF THE NEW BUILDING OF GURUDWARA SHRU DASMESH DARBAR @ 166 KOLMAR ROAD</marquee>
    </div>

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

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




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

</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.