HTML <style> Tag

If this site has been useful, we’d love your support! Running this site takes time and resources, and every small contribution helps us keep creating valuable content. Consider buying us a coffee to keep things going strong!

Description

The <style> HTML element is used for declaring style sheets within the head of your HTML document. Check out all the CSS Properties that you can use in your style sheets.

Properties

Permitted Parents
Any element that accepts metadata content
Content
Style information
Start/End Tags
Start tag: required, End tag: required

Example

<html>
<head>
<style type="text/css">
h1 { color:#800000 }
</style>
</head>
<body>
<h1>The style tag in action</h1>
</body>
</html>

Attributes

Attribute Definition
type Specifies the style sheet language as a content-type (MIME type).
media Specifies the device the document will be displayed on. Possible values:
  • all
  • braille
  • print
  • projection
  • screen
  • speech

Global Attributes

The <style> tag also supports the Global Attributes in HTML5

Event Attributes

The <style> tag also supports the Event Attributes in HTML5

Browser Support

The following table will show you the current browser support for the HTML <style> tag.

Desktop
Edge Chrome Firefox Opera Safari
12113.51
Tablets / Mobile
Chrome Firefox Opera Safari Samsung Webview
18410.1114.4

Last updated by CSSPortal on: 30th March 2024