HTML Tag Reference - HTML tag <style>

This <style> element allows a style sheet to be specified for the page. It should appear within the <head> section of a document.

Browser compatibility

<style> Yes Yes Yes Yes Yes

What's new in HTML5



Attribute Value Description
media media_query Indicate media/device type for this style
scoped scoped Set that the styles only apply to this element's parent element and child elements
type text/css Set the media type of the <style> tag

Global Attributes

The <style> tag supports the Global Attributes in HTML.

Event Attributes

The <style> tag supports the Event Attributes in HTML.

Default CSS Settings

style {
    display: none;


A demo showing how to use <style> tag.

body {<!--from  w  ww  .j a  v  a  2s .c  o  m-->
     background-color: black;
     color: white;
<body>The body cotains a black background and white letters.

Click to view the demo