HTML Style Tag

Reference on the HTML Style Tag. Including its useful example, and a list of the allowed attributes.

The Style Element is used to embed, or load external styling rules, such as CSS StyleSheet. These rules are used to control the appearance and layout of a page.

Attributes

Attribute:Value:Description:
AttrsOther AttributesI18n
typeContent TypeThe Content Type of the scripting language used.
mediaMedia DescriptorEither a single, or comma-separated list. I.e. "screen,print"
titleTextAdvisory title

Example

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">

  <head>
    <title>My first Website</title>
    <style type="text/css">
      h1 {color:#0000FF;}
      p {font-size:2em;}
    </style>
  </head>

  <body>
    <h1>My first use of Style</h1>
    <p>Using CSS to change the style of headings and paragraphs</p>

  </body>

</html>

Post comment

Links that you insert are not nofollowed, but will be removed by admins if they are considered spam.

[url=Absolute URL for page]TITLE[/url]

You should insert code boxes around code examples, which will be automatically syntax highlighted.

[code1 html|css|javascript|php|sql]Your Code Here[/code1]

You may want to read our Privacy Policy before submitting your comment.