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

CSS CSS Foundations Getting Started with CSS Adding CSS to a Page

CSS "style" attribute not showing in browser

im following "getting started with CSS". when i put in the style attribute and refresh its not showing in browser. the file is saved as html.

<!doctype html>

<html lang="en">
 <head>
   <title>Adding CSS</title>
 </head>
 <body stlye="background-color: #BDD4DE">
    <h1>Adding CSS to the Page!</h1>
    <p stlyle="font-weight: bold">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc consectetur laoreet pellentesque. Nulla sem metus, consectetur et risus id, convallis tristique mi. Phasellus at volutpat ligula, quis suscipit purus. Duis dictum rhoncus tincidunt. Nunc gravida ligula quis sem pretium, sit amet elementum massa molestie. Nullam fermentum lacus ipsum, et dictum dolor suscipit sed. Nulla nec magna nisi. Nam vel placerat augue, ac iaculis orci. Suspendisse in tellus et est varius aliquet semper eu leo.</p>
    <p>Vestibulum rutrum lacinia neque. Sed egestas eu elit eu ornare. Ut dignissim ex metus. Nunc nulla urna, malesuada non mi ac, laoreet bibendum diam. Sed dapibus orci nec sollicitudin semper. Integer tincidunt eget nisi ac finibus. Morbi viverra leo et condimentum porta. Sed rutrum vestibulum nunc at hendrerit. Nam suscipit facilisis augue, sit amet dapibus nunc molestie lobortis. Sed consequat ut arcu id pharetra. Integer auctor volutpat ornare.</p>
    <h2>Lorem ipsum dolor sit amet</h2>
    <ul>
        <li>consectetur et risus id.</li>
        <li>Nulla sem metus.</li>
        <li>convallis tristique mi.</li>

    </ul>
 </body>
</html>

2 Answers

Michael Hulet
Michael Hulet
47,912 Points

That would be because you misspelled "style" in both of them. Fix that, and also, add a semicolon after each of your CSS statements, and it should work

hahaha thats soo funny XD wow

Michael Hulet
Michael Hulet
47,912 Points

Also, you should make the lang attribute on your <html> tag a little more specific, because for some reason, en-US and en-GB are two different languages

John Steer-Fowler
John Steer-Fowler
Courses Plus Student 11,734 Points

Convention also dictates that your doctype should be written in caps like this:

<!DOCTYPE html>
Tobiasz Gala
seal-mask
.a{fill-rule:evenodd;}techdegree
Tobiasz Gala
Full Stack JavaScript Techdegree Student 23,529 Points

Don't forget that linking style sheet is a better way and good practice. Also don't forget about hierarchy, you can overwrite external style sheet with inline styling.