Using the title attribute of the iframe element

ID: H64

Technology: html

Type: Technique

When to Use

HTML documents that use iframes

Description

The objective of this technique is to demonstrate the use of the title attribute of the iframe element to describe its contents. This provides a label for the frame so users can determine which frame to enter and explore in detail. It does not label the content inside the iframe.

The title attribute labels iframes, and is different from the title element which labels documents. Both should be provided, since the first facilitates navigation among iframes and the second clarifies the user's current page.

The title attribute is not interchangeable with the name attribute. The title labels the frame for users; the name labels it for scripting and window targeting. The name is not presented to the user, only the title is.

Examples

Using the title attribute with an iframe to describe the iframe's content

<!doctype html>
<html lang="en">
<head>
   <title>A document using an iframe</title>
</head>
...
<iframe src="banner-ad.html" name="ad-iframe" title="Advertisement"></iframe>
...
</html>

Tests

Procedure

  1. Check each iframe element in the HTML source code for the presence of a title attribute.
  2. Check that the title attribute contains text that describes the iframe's content.

Expected Results

Resources