Archive
This post is archived and may contain outdated information. It has been set to 'noindex' and should stop showing up in search results.
This post is archived and may contain outdated information. It has been set to 'noindex' and should stop showing up in search results.
Is type="text/css" Needed for Style and Link Tags?
Jul 8, 2014Web DevelopmentComments (1)
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:
Just make sure you're using the new HTML5 doctype at the top of your HTML document:
I tested this all the way back to Internet Explorer 6.
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.