Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

HTML HTML Basics Structuring Your Content Grouping Content Challenge

Antonio Paturzo
Antonio Paturzo
5,042 Points

Why is Task 3 not working? My main element will not wrap the entire length of this code for some reason?

I have tried every single possible solution to this problem and the site is just throwing errors at me left and right. I left the code like this so if someone would like to look at it be my guest. I am not new to HTML and I do not know why this is not working.

index.html
<!DOCTYPE html>
<html>
  <head>
    <link href="styles.css" rel="stylesheet">
    <title>My Blog</title>
  </head>
  <body>
    <header>
      <h1>My Web Design &amp; Development Blog!</h1> 
      <nav>
        <ul>
          <li><a href="#">About</a></li>
          <li><a href="#">Articles</a></li>
          <li><a href="#">Recent Work</a></li>            
        </ul>
      </nav>
    </header>
   <main>
    <h2>The Main Articles</h2>  
    </main>
    <main>
    <article>
    <h3>My Favorite HTML Courses</h3> 
    <p>Fusce semper id ipsum sed scelerisque. Etiam nec elementum massa. Pellentesque tristique ex ac ipsum hendrerit, eget <a href="#">feugiat ante faucibus</a>.</p>
    </article>
    </main>
    <main>
    <article>
    <h3>10 Handy CSS Features</h3> 
    <p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in faucibus orci luctus et <a href="#">ultrices posuere</a>.</p>    
    </article>
    </main>
    <main>
    <article>
      <aside>
    <h3>Follow Me on Social Media:</h3>
      </aside>
    </article>
    <aside>
    <ul>
      <li><a href="#">Twitter</a></li>
      <li><a href="#">Facebook</a></li>
      <li><a href="#">LinkedIn</a></li>     
    </ul>
      </aside>
    </main>
    <footer>
      <main>
      <article>
      <p>&copy; 2017 My Blog</p>
      </article>
      </main>
    </footer>
  </body>
</html>

1 Answer

I don't really make use of the <main> tag, but you definitely can get away with using just one of them. I've included working code for the challenge, as well as some comments to show you where I placed the main tag's opening and closing statements.

<!DOCTYPE html>
<html>
  <head>
    <link href="styles.css" rel="stylesheet">
    <title>My Blog</title>
  </head>
  <body>
    <header>
      <h1>My Web Design &amp; Development Blog!</h1> 
      <nav>
        <ul>
          <li><a href="#">About</a></li>
          <li><a href="#">Articles</a></li>
          <li><a href="#">Recent Work</a></li>            
        </ul>
      </nav>
    </header>
<!--You only need to include 1 main element for this exercise-->
   <main>
    <h2>The Main Articles</h2>  
    <article>
    <h3>My Favorite HTML Courses</h3> 
    <p>Fusce semper id ipsum sed scelerisque. Etiam nec elementum massa. Pellentesque tristique ex ac ipsum hendrerit, eget <a href="#">feugiat ante faucibus</a>.</p>
    </article>
    <article>
    <h3>10 Handy CSS Features</h3> 
    <p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in faucibus orci luctus et <a href="#">ultrices posuere</a>.</p>    
    </article>
    </main>
<!-- End the main tag here -->
      <aside>
    <h3>Follow Me on Social Media:</h3>
    <ul>
      <li><a href="#">Twitter</a></li>
      <li><a href="#">Facebook</a></li>
      <li><a href="#">LinkedIn</a></li>     
    </ul>
      </aside>
    <footer>
      <p>&copy; 2017 My Blog</p>
    </footer>
  </body>
</html>

If you get into languages like Bootstrap, you'll notice that <div> is used pretty much everywhere instead. It's not relevant here, but I figured I would mention it for the sake of awareness in case you DO decide to use Bootstrap one day (It's a good CSS framework).

If you have any further questions, please let me know.