HTML tags can contain one or more attributes. Attributes are added to a tag to provide the browser with more information about how the tag should appear or behave. Attributes consist of a name and a value separated by an equals (=) sign.
<p style="background-color:orange;">Do you like my background color?</p>
<a href="http://www.jesmansblog.net">This is a link</a>
Many attributes are available to HTML elements, some are common across most tags, others can only be used on certain tags.
Below is a list of some attributes that can be used on any HTML element:
class ==> Specifies one or more classnames for an element (refers to a class in a style sheet)
id ==> Specifies a unique id for an element
style ==> Specifies an inline CSS style for an element
title ==> Specifies extra information about an element (displayed as a tool tip)
<<Add More To Your Basic HTML Page #2
- 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"
<p style="background-color:orange;">Do you like my background color?</p>
<a href="http://www.jesmansblog.net">This is a link</a>
- This particular attribute statement,
style="background-color:orange", tells the browser to style the <p> element with a background color of orange. - HTML links are defined with the <a> tag. The link address is specified in the href attribute.
- Attribute values should always be enclosed in quotes.
- Double style quotes are the most common, but single style quotes are also allowed.
- Attribute names and attribute values are case-insensitive.
Many attributes are available to HTML elements, some are common across most tags, others can only be used on certain tags.
Below is a list of some attributes that can be used on any HTML element:
class ==> Specifies one or more classnames for an element (refers to a class in a style sheet)
id ==> Specifies a unique id for an element
style ==> Specifies an inline CSS style for an element
title ==> Specifies extra information about an element (displayed as a tool tip)
<<Add More To Your Basic HTML Page #2







