H3XED

Is type="text/css" Needed for Style and Link Tags?

Jul 8, 2014   Web Development   Nick Vogt   Comments
Please note that this post is over a year old and may contain outdated information.
When used in either an inline stylesheet or an external stylesheet, the attribute type="text/css" is optional as of HTML5. In the HTML4 spec it was needed, though browsers were forgiving. If omitted, browsers will default to text/css.

You can safely do this:

<style></style>
<link rel="stylesheet" href="style.css">

Just make sure you're using the new HTML5 doctype at the top of your HTML document:

<!DOCTYPE html>
I tested this all the way back to Internet Explorer 6.
Share This Post
Twitter

Comments (0)

Share This Post
Twitter
H3XED © Nick Vogt   RSS   Policies   Twitter