<style type="">

Disclosure: Your support helps keep the site running! We earn a referral fee for some of the services we recommend on this page. Learn more
Attribute of
How To Use To Add CSS Style Rules To HTML Documents
What does <style type=""> do?
Identifies the type of media contained within a <style> element. However, the only supported value is text/css, so the attribute is not needed.

Code Example

<style type="text/css">

/* insert CSS rules here */


The type attribute applied to the style tag has only one acceptable value: text/css. In theory, other types of styling could also be used between style tags–thus the need for a type attribute. However, in practice, the only type of styling supported by modern browsers at this time (and for the foreseeable future) is CSS. So this attribute is not necessary. Sure, you can add it if you like, but it’s not needed and doesn’t provide any useful information to a user’s browser.

Adam is a technical writer who specializes in developer documentation and tutorials.