html5 Site Icon CSS3 Site Icon CSS Site Icon

HTML4 Reference

HTML <style> tag

Definition

The <style> tag and its' closing <style> tag allows us to put style information into our HTML documents and must reside within the <head> </head> element.

Example


<html  xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>Appears in browser toolbar, favourites and search engime results.</title>

  <style type="text/css">.red {color: red;} </style>

</head>

<body>
  <h1 class="red">Importing Files and Using Meta Information</h1>
</body>
</html>

Required Attributes

type specifies the MIME type of the style sheet.


<style type="text/javascript"></style>

Optional Attributes

media specifies a media with which the link is associated with.


<!-- media values supported in all browsers are (all, print, and screen) -->]

<!-- Other possible values are (aural, braille, handheld, projection tty and tv) -->
<style type="text/javascript" media="print"></style> 

Common Attributes

NONE

Language Attributes

dir - specifies the directional flow of the content.


<style dir="ltr"></style>   <!-- The text will flow from left to right -->
<style dir="rtl"></style>   <!-- The text will flow from right to left -->

lang - specifies a language code for the content of the element.


<style lang="en"></style>

xml:lang - specifies a language code for the content of the element in XHTML documents.


<style xml:lang="fr"></style>

Event Attributes

NONE



<strong> tags    << Prev          Next >>  <sub> tag

go to home page Homepage go to top of page Top