Go to main content
Bypass navigation bar HTML Reference HTML Tags HTML Tutorials
Bypass language selection
Bypass location bar

Location: Home > HTML Reference > HTML Tags > HTML style tag

Bypass main content

HTML style tag

Note: If you don't know what an element/tag is and/or how you must use it we recommend you to read our HTML tags and attributes tutorial that you can find in our HTML tutorials section.

Bypass main content


The HTML style element allows authors to insert style sheets information inside the document. Differently from the "style" attribute, this element allows the insertion of classes or ID selectors, increasing the versatility of the style sheets implementation.

The HTML style element can only be inserted in the document's head (HTML head element).

Another alternative for inserting style sheet information, and maybe more convenient because of the possibility of sharing it among many documents, is to place a reference to an external file using the HTML link tag. This way, many documents can link to a single style sheets files making it easier to edit the visual aspects of the elements.


<style type="text/css">
p {font-size: 8pt; font-family: arial,helvetica}
p.big {font-size: 12pt; font-family: arial,helvetica}


title (text)

The purpose of this attribute is to provide a title for the element. Its value must be a short and accurate description of the element. Browsers usually render it as a "tool tip" when the user puts the mouse pointer over the element for a small period of time.

<a title="HTMLQuick.com" href="http://www.htmlquick.com">HTML code</a>

lang (langcode)

Specifies the language of an element's content. The default value in "unknown".

When writing XHTML 1.0 documents, the attribute used to specify the language of an elements is "xml:lang". For forward and backward compatibility both attributes can be used simultaneously like in the example below. Note, that in XHTML 1.1 the "lang" attribute has been completely replaced by "xml:lang" and its use is no longer valid.

<p lang="en" xml:lang="en">This is a paragraph in english.</p>
<p lang="es" xml:lang="es">Este es un párrafo en español.</p>


This attribute indicates the direction in which the texts of the element must be read. This includes content, attribute values and tables. It has two possible values that are case-insensitive:

  • RTL: Right to left.
  • LTR: Left to right.
<q lang="he" dir="rtl">...an Hebrew quotation...</q>

type (content-type)

Declares the style sheet language used in the content of the element, as a content-type.

<style type="text/css">
...Style declarations...

media (media-descriptor)

Specifies the media for which the element's content has been designed. It can be a single media or a comma-separated list of medias. The default value is "screen".

<style type="text/css" media="print">
...Style declarations...


This element doesn't support any event.

See a complete list and information about events in HTML

Diseño y desarrollo: Latitud29.com

Links and logos|Contact|Beyond HTML|Tools and resources|Sitemap|Webmaster|Donate