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

General Discussion

Classes and IDs

When trying to add this style rule , for some reason it won't work.:

.container {
    width:740px;
    margin:auto;
}
<!DOCTYPE html>
<html>
<head>
    <title>Classes and IDs</title>
    <link rel="stylesheet" href="css/style.css">
</head>
<body>
    <div class="container">
        <header>
            Header
        </header>
        <div>
            <h1>Classes and ID Selectors</h1>
            <p>
                Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi tristique, orci et tincidunt fermentum, odio quam aliquam eros, tempus elementum enim elit eu libero. Suspendisse ut odio non augue bibendum tristique. Cras rutrum sollicitudin enim, in iaculis quam congue ut. Maecenas id leo non neque porttitor adipiscing vel in justo.
            </p>
            <p>
                Aenean eu turpis sed mauris fermentum tempus tristique non lacus. Maecenas volutpat sed dui in consectetur. Integer dui dolor, consectetur in mauris a, egestas fermentum orci. In hendrerit, tortor at eleifend rhoncus, odio arcu fringilla sapien, nec pretium elit turpis ut nunc. Phasellus in diam libero. Proin vel orci risus. 
            </p>
            <p>
                Duis bibendum tortor vel condimentum hendrerit. Phasellus tincidunt, augue non malesuada malesuada, tellus elit mattis orci, ut pretium orci felis vitae augue. Proin porta, mauris sed lobortis feugiat, leo augue pulvinar diam, eget gravida nibh elit et dui. 
            </p>
        </div>
        <footer>
            Footer
        </footer>
    </div>
</body>
</html>

2 Answers

Try closing the div before you start the footer tag and then doing another div tag for the footer. Also, are you able to use header and footer without the section tag inbetween?

Michael Austin
PLUS
Michael Austin
Courses Plus Student 7,814 Points

Hi,

This should work fine. Do you have any other style rules in the CSS file? If not I would check that your CSS file is in the correct location. I would also add type="text/css” to your CSS link tag.

Just as a little pointer you should also always set the character set in the head

<meta charset="UTF-8">