Element Attributes

Description

Elements can be configured by their attributes.

Example

The following code shows an attribute that applies to the a element.


I like <a href="/index.htm">CSS</a> and HTML.

a element lets you create a hyperlink that, when it's clicked on, loads a different HTML document.

Quote

The code above uses double quotes "/index.htm" to delimit the attribute value. You can also use single quotes '/index.htm'.

To specify a value for an attribute containing quotes, you use both styles "my 'HTML' value" or 'my "HTML" value'.

Note

Attributes have a name and a value. In the code above the name of the attribute is href. Its value is /index.htm.

Attributes can be added only to start tags or single tags

Attributes can never be added to end tags.

Note 2

There are a set of global attributes that can be applied to any HTML element

Elements can define their own attributes that provide configuration information specific to the element.

For example, the href attribute is local to the a element. It configures the URL for the hyperlink.





















Home »
  HTML CSS »
    HTML »




HTML Introduction
HTML Document
HTML Section
HTML Group Content
HTML Text Marker
HTML Table
HTML Form
HTML Embed