HTML style - how to use <style> tag

The HTML <style> tag is used to define styles for different tags within a page. The <style> tag can override styles defined in an external CSS files.

The <style> tag is part of a page and therefore styles defined using the <style> tag cannot be reused on other pages. To re-use on other pages, define a CSS file and link to it.


The style tag supports the global and event attributes.

Defines the device type the style is optimised for
Defines that the style is supported by only its parent element and child elements. Note this attribute is only supported by Firefox.
Defines the media type


<head> <style type="text/css"> p { color:red; font-weight:bold;} ul li { list-style-type:none;} </style> </head>

Related HTML tags:

  • <link> - used to link to an external CSS file
  • <> - used to
  • <> - used to