Attribute (HTML)

From Wiki @ Karl Jones dot com
Revision as of 18:35, 20 April 2016 by Karl Jones (Talk | contribs) (Created page with "In HTML, an attribute part of an HTML element. Attributes may be optional or required, depending up on the element and its use. Attributes are made up of two parts:...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

In HTML, an attribute part of an HTML element. Attributes may be optional or required, depending up on the element and its use.

Attributes are made up of two parts: name and value.

Examples

The a element requires an attribute named href, which specifies what the link is linking to.

The attribute looks like this:

href="value"

Where "value" is a URL, or a path to a resource.

In this example, the value of the attribute is a fully-qualified URL for Wikipedia:

<a href="http://wikipedia.org">Wikipedia</a>

In this example, the value of the attribute is another web page on the same website.

<a href="../another-page.html">Another web page</a>

See also