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

<!DOCTYPE html> tag question

Hey everybody,

I built a simple website the other day just for practice. I started with just an <html> tag at the top of the document and when I finished I recalled the HTML 5 tag: <!DOCTYPE html>. I put that in saved it and lost much of the color in my site. When I removed the DOCTYPE tag and used just the <html> tag again the color returned. Why does this happen?

Thanks for any input,

Demian

1 Answer

Sounds like you've got some invalid HTML, try running your markup through the W3C's HTML5 validator

Thanks, James. I'll try that. Don't know why what I typed didn't fully print here. I was trying to say that initially I used a regular html tag and then ended up going back to it to get the colors back.

When you say invalid html you mean it's outdated, right?

Thanks,

Demian

Not outdated, but invalid in the sense that the browser would be unable to render it because it doesn't understand it, this could purely be an incorrect tag used or anything such like.

Typical HTML 5 structure would be like this:

<!DOCTYPE html>
<html>
    <head>
        Meta and stuff goes here
    </head>
    <body>
        Body content
    </body>
</html>