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

Why do we need type=text/css?

when we're creating our website, to link our html file to css, why don't we use type=text/css?I thought that that was also required to link html to css, but all we're using is rel=stylesheet and href=css/filename.css

4 Answers

The type attribute is not required in HTML5. If however, your html page was using HTML4 or below, you would need the type attribute when linking to a stylesheet. Considering that most stylesheets are usually text/css, it really doesn't make sense to have people constantly typing that out, right?

It's not required with the HTML5 spec, but for older versions of HTML is it required. This course is based on HTML5.

Thanks!

When the concept of stylesheets was first added to HTML it was thought that other stylesheet languages (beside CSS) might be used. Historically there is XLST which is the styling counterpart to XML, eventually CSS would eclipse it the late days of HTML4 and as of HTML5 CSS is the presumed default.