HTML Attributes
HTML Attributes:Attributes
provide additional information about HTML elements.
- HTML
elements can have attributes
- Attributes
provide additional information about an element
- Attributes
are always specified in the start tag
- Attributes
come in name/value pairs like: name="value"
Attribute Example
HTML links are defined with the <a> tag. The link address is specified
in the href attribute:
Example
<a href="http://www.abc.com">This is
a link</a>
Always Quote Attribute Values
Attribute values should always be enclosed in quotes. Double style quotes are the most common, but single style quotes are also allowed.
In some rare situations, when the attribute value itself contains quotes, it is necessary to use single quotes: name='John "ShotGun" Nelson'
Use Lowercase Attributes
Attribute names and attribute values are case-insensitive.However, the World Wide Web Consortium (W3C) recommends lowercase attributes/attribute values in their HTML 4 recommendation.
Newer versions of (X)HTML will demand lowercase attributes.
HTML Attributes Reference
Below is a list of some attributes that are standard for most HTML elements:
Attribute
|
Value
|
Description
|
||
class
|
classname
|
Specifies a classname for an element
|
||
id
|
id
|
Specifies a unique id for an element
|
||
style
|
style_definition
|
Specifies an inline style for an element
|
||
title
|
tooltip_text
|
Specifies extra information about an element
(displayed as a tool tip)
|
||
No comments:
Post a Comment