Loading...
HTML <style> Tag

HTML <style> Tag

In this tutorial, we will learn about style tag in HTML with the help of examples.


<style> Tag

Style tag <style> is used for declaring stylesheets within the head of your HTML document.

Note : The <style> tag specifies how the HTML elements should displayed in a browser.

Syntax

<style>..........</style>

Example

<!DOCTYPE html>
<html>
  <head>
    <title>Style Tag</title>
    <style type = "text/css">
      p {
        color : yellow;
        background-color : black;
      }
    </style>
  </head>
  <body>
      <p>This is the paragraph.</p>
  </body>
</html>

Output

This is the paragraph.


Specific Attribute

Attribute Value Description
type text/css It specifies the stylesheet language as a content-type (MIME type)
media screen
tty
tv
projection
handheld
print
braille
aural
all
It specifies the device the document will be displayed on

Global Attribute

Style Tag support all the global attributes of HTML.


Event Attribute

Style Tag support all the event attributes of HTML.


Next Tutorial

We hope that this tutorial helped you develop better understanding of the concept of <style> tag in HTML.

Keep Learning : )

In the next tutorial, you'll learn about HTML <sub> Tag.

- Related Topics