HTML Title Attribute


Definition and Usage

The title attribute specifies extra information about an element such as a description or definition that would not be otherwise shown.

The information is usually shown as a tooltip text when the mouse hovers over the element.


Example

Use of the title attribute in an HTML document:

<p><abbr title="World Health Organization">WHO</abbr> was founded in 1948.</p>
<p title="Learning Web Design">HTML 201</p>
Try it yourself »

Browser Support

Attribute
title Yes Yes Yes Yes Yes

Differences Between HTML 4.01 and HTML5

In HTML5, the title attribute can be used on any HTML element (it will validate on any HTML element. However, it is not necessarily useful).

In HTML 4.01, the title attribute cannot be used with: <base>, <head>, <html>, <meta>, <param>, <script>, <style>, and <title>.


Syntax

<element title="text">

Attribute Values

Value Description
text A tooltip text for an element


 







HTML Element Reference


Ordered Alphabetically

= New in HTML5

' ' '
Tag Description
<!--...--> Defines a comment
<!DOCTYPE>  Defines the document type
<a> Defines a hyperlink
<abbr> Defines an abbreviation or an acronym
<acronym> Not supported in HTML5. Use <abbr> instead.
Defines an acronym
<address> Defines contact information for the author/owner of a document
<applet> Not supported in HTML5. Use <embed> or <object> instead.
Defines an embedded applet
<area> Defines an area inside an image-map
<article> Defines an article
<aside> Defines content aside from the page content
<audio> Defines sound content
<b> Defines bold text
<base> Specifies the base URL/target for all relative URLs in a document
<basefont> Not supported in HTML5. Use CSS instead.
Specifies a default color, size, and font for all text in a document
<bdi> Isolates a part of text that might be formatted in a different direction from other text outside it
<bdo> Overrides the current text direction
<big> Not supported in HTML5. Use CSS instead.
Defines big text
<blockquote> Defines a section that is quoted from another source
<body> Defines the document's body
<br> Defines a single line break
<button> Defines a clickable button
<canvas> Used to draw graphics, on the fly, via scripting (usually JavaScript)
<caption> Defines a table caption
<center> Not supported in HTML5. Use CSS instead.
Defines centered text
<cite> Defines the title of a work
<code> Defines a piece of computer code
<col> Specifies column properties for each column within a <colgroup> element 
<colgroup> Specifies a group of one or more columns in a table for formatting
<datalist> Specifies a list of pre-defined options for input controls
<dd> Defines a description/value of a term in a description list
<del> Defines text that has been deleted from a document
<details> Defines additional details that the user can view or hide
<dfn> Represents the defining instance of a term
<dialog> Defines a dialog box or window
<dir> Not supported in HTML5. Use <ul> instead.
Defines a directory list
<div> Defines a section in a document
<dl> Defines a description list
<dt> Defines a term/name in a description list
<em> Defines emphasized text 
<embed> Defines a container for an external (non-HTML) application
<fieldset> Groups related elements in a form
<figcaption> Defines a caption for a <figure> element
<figure> Specifies self-contained content
<font> Not supported in HTML5. Use CSS instead.
Defines font, color, and size for text
<footer> Defines a footer for a document or section
<form> Defines an HTML form for user input
<frame> Not supported in HTML5.
Defines a window (a frame) in a frameset
<frameset> Not supported in HTML5.
Defines a set of frames
<h1> to <h6> Defines HTML headings
<head> Defines information about the document
<header> Defines a header for a document or section
<hr> Defines a thematic change in the content
<html> Defines the root of an HTML document
<i> Defines a part of text in an alternate voice or mood
<iframe> Defines an inline frame
<img> Defines an image
<input> Defines an input control
<ins> Defines a text that has been inserted into a document
<kbd> Defines keyboard input
<keygen> Defines a key-pair generator field (for forms)
<label> Defines a label for an <input> element
<legend> Defines a caption for a <fieldset> element
<li> Defines a list item
<link> Defines the relationship between a document and an external resource (most used to link to style sheets)
<main> Specifies the main content of a document
<map> Defines a client-side image-map
<mark> Defines marked/highlighted text
<menu> Defines a list/menu of commands
<menuitem> Defines a command/menu item that the user can invoke from a popup menu
><meta> Defines metadata about an HTML document
<meter> Defines a scalar measurement within a known range (a gauge)
<nav> Defines navigation links
<noframes> Not supported in HTML5.
Defines an alternate content for users that do not support frames
<noscript> Defines an alternate content for users that do not support client-side scripts
<object> Defines an embedded object
<ol> Defines an ordered list
<optgroup> Defines a group of related options in a drop-down list
<option> Defines an option in a drop-down list
<output> Defines the result of a calculation
<p> Defines a paragraph
<param> Defines a parameter for an object
<pre> Defines preformatted text
<progress> Represents the progress of a task
<q> Defines a short quotation
<rp> Defines what to show in browsers that do not support ruby annotations
<rt> Defines an explanation/pronunciation of characters (for East Asian typography)
<ruby> Defines a ruby annotation (for East Asian typography)
<s> Defines text that is no longer correct
<samp> Defines sample output from a computer program
<script> Defines a client-side script
<section> Defines a section in a document
<select> Defines a drop-down list
<small> Defines smaller text
<source> Defines multiple media resources for media elements (<video> and <audio>)
<span> Defines a section in a document
<strike> Not supported in HTML5. Use <del> or <s> instead.
Defines strikethrough text
<strong> Defines important text
<style> Defines style information for a document
<sub> Defines subscripted text
<summary> Defines a visible heading for a <details> element
<sup> Defines superscripted text
<table> Defines a table
<tbody> Groups the body content in a table
<td> Defines a cell in a table
<textarea> Defines a multiline input control (text area)
<tfoot> Groups the footer content in a table
<th> Defines a header cell in a table
<thead> Groups the header content in a table
<time> Defines a date/time
<title> Defines a title for the document
<tr> Defines a row in a table
<track> Defines text tracks for media elements (<video> and <audio>)
<tt> Not supported in HTML5. Use CSS instead.
Defines teletype text
<u> Defines text that should be stylistically different from normal text
<ul> Defines an unordered list
<var> Defines a variable
<video> Defines a video or movie
<wbr> Defines a possible line-break

 







HTML <link> Tag


Definition and Usage

The <link> tag defines a link between a document and an external resource.

The <link> tag is used to link to external style sheets.


Example

Link to an external style sheet:

<head>
<link rel="stylesheet" type="text/css" href="theme.css">
</head>

Browser Support

When used for style sheets, the <link> tag is supported in all major browsers. No real support for anything else.

Element
<link> Yes Yes Yes Yes Yes

Note: The <link> element is an empty element, it contains attributes only.

Note: This element goes only in the head section, but it can appear any number of times.


Differences Between HTML 4.01 and HTML5

Some HTML 4.01 attributes are not supported in HTML5.

The "sizes" attribute is new in HTML5.


Differences Between HTML and XHTML

In HTML the <link> tag has no end tag.

In XHTML the <link> tag must be properly closed.


Attributes

= New in HTML5.

Attribute Value Description
charset char_encoding Not supported in HTML5.
Specifies the character encoding of the linked document
crossorigin anonymous
use-credentials
Specifies how the element handles cross-origin requests
href URL Specifies the location of the linked document
hreflang language_code Specifies the language of the text in the linked document
media media_query Specifies on what device the linked document will be displayed
rel alternate
archives
author
bookmark
external
first
help
icon
last
license
next
nofollow
noreferrer
pingback
prefetch
prev
search
sidebar
stylesheet
tag
up
Required. Specifies the relationship between the current document and the linked document
rev reversed relationship Not supported in HTML5.
Specifies the relationship between the linked document and the current document
sizes HeightxWidth
any
Specifies the size of the linked resource. Only for rel="icon"
target _blank
_self
_top
_parent
frame_name
Not supported in HTML5.
Specifies where the linked document is to be loaded
type media_type Specifies the media type of the linked document

Global Attributes

The <link> tag also supports the Global Attributes in HTML.


Event Attributes

The <link> tag also supports the Event Attributes in HTML.


Related Pages

HTML tutorial: HTML Styles

HTML DOM reference: Link Object


Default CSS Settings

Most browsers will display the <link> element with the following default values:

link {
    display: none;
}


 







HTML <style> Tag


Definition and Usage

The <style> tag is used to define style information for an HTML document.

Inside the <style> element you specify how HTML elements should render in a browser.

Each HTML document can contain multiple <style> tags.


Example

Use of the <style> element in an HTML document:

<html>
<head>
<style>
h1 {color:red;}
p {color:blue;}
</style>
</head>
<body>

<h1>A heading</h1>
<p>A paragraph.</p>

</body>
</html>
Try it yourself »

Browser Support

Element
<style> Yes Yes Yes Yes Yes

Tips and Notes

Tip: To link to an external style sheet, use the <link> tag.

Tip: To learn more about style sheets, please read our CSS Tutorial.

Note: If the "scoped" attribute is not used, each <style> tag must be located in the head section.


Differences Between HTML 4.01 and HTML5

The "scoped" attribute is new in HTML5, which allows to define styles for a specified section of the document. If the "scoped" attribute is present, the styles only apply to the style element's parent element and that element's child elements.


Attributes

= New in HTML5.

Attribute Value Description
media media_query Specifies what media/device the media resource is optimized for
scoped scoped Specifies that the styles only apply to this element's parent element and that element's child elements
type text/css Specifies the media type of the <style> tag

Global Attributes

The <style> tag also supports the Global Attributes in HTML.


Event Attributes

The <style> tag also supports the Event Attributes in HTML.


Related Pages

HTML tutorial: HTML CSS

CSS tutorial: CSS Tutorial

HTML DOM reference: Style Object


Default CSS Settings

Most browsers will display the <style> element with the following default values:

style {
    display: none;
}


 







HTML <iframe> Tag


Definition and Usage

The <iframe> tag specifies an inline frame.

An inline frame is used to embed another document within the current HTML document.


Example

An inline frame is marked up as follows:

<iframe src="http://www.w3schools.com"></iframe>

Browser Support

Element
<iframe> Yes Yes Yes Yes Yes Yes

Tips and Notes

Tip: To deal with browsers that do not support <iframe>, add a text between the opening <iframe> tag and the closing </iframe> tag.

Tip: Use CSS to style the <iframe> (even to include scrollbars).


Differences Between HTML 4.01 and HTML5

HTML5 has added some new attributes, and several HTML 4.01 attributes are removed from HTML5.


Differences Between HTML and XHTML

In XHTML, the name attribute is deprecated, and will be removed. Use the global id attribute instead.


Attributes

= New in HTML5.

Attribute Value Description
align left
right
top
middle
bottom
Not supported in HTML5.
Specifies the alignment of an <iframe> according to surrounding elements
frameborder 1
0
Not supported in HTML5.
Specifies whether or not to display a border around an <iframe>
height pixels Specifies the height of an <iframe>
longdesc URL Not supported in HTML5.
Specifies a page that contains a long description of the content of an <iframe>
marginheight pixels Not supported in HTML5.
Specifies the top and bottom margins of the content of an <iframe>
marginwidth pixels Not supported in HTML5.
Specifies the left and right margins of the content of an <iframe>
name text Specifies the name of an <iframe>
sandbox allow-forms
allow-pointer-lock
allow-popups
allow-same-origin
allow-scripts
allow-top-navigation
Enables an extra set of restrictions for the content in an <iframe>
scrolling yes
no
auto
Not supported in HTML5.
Specifies whether or not to display scrollbars in an <iframe>
src URL Specifies the address of the document to embed in the <iframe>
srcdoc HTML_code Specifies the HTML content of the page to show in the <iframe>
width pixels Specifies the width of an <iframe>

Global Attributes

The <iframe> tag also supports the Global Attributes in HTML.


Event Attributes

The <iframe> tag also supports the Event Attributes in HTML.


Related Pages

HTML tutorial: HTML Iframes

HTML DOM reference: IFrame Object


Default CSS Settings

Most browsers will display the <iframe> element with the following default values:

iframe:focus {
    outline: none;
}

iframe[seamless] {
    display: block;
}