<style> tag

HTML <style> tag

The <style> tag is used to add style to the HTML document.

It is a way to add an Inline CSS or Internal CSS.

Syntax:
<style> CSS properties….</style>

Example

<style>
   body {background-color: lightskyblue;}
   h2 {color: darkslateblue;} 
   p {color: crimson;}
 </style>

How Browser will display

INLINE.

Difference between HTML4.01, XHTML and HTML5

HTML4 XHTML HTML5
None None None

Attributes used with <style> tag

Attribute Description
type To inform about the type of media for the element. For this, you should text/css
media This sets the media or device for which this element is mostly suited for. You will use a media query for this purpose.

Global Attributes

The <style> tag supports Global attributes.

Event Attributes

The <style> tag supports Event attributes.

Supporting Browsers

supporting-browsers for tags

Related Tags

<head> & <link> tags.

Tutorials for all brains!