Saturday, 4 January 2014

Tutorial 7: HTML Attributes

HTML Attributes


1.In HTML, attributes provide additional information about HTML elements.

2.Attributes are always specified in the start tag.

3.Attributes come in name & value pairs like: name="value"

EXAMPLE:

In the below code, the link address is specified by href attribute.

<a href="http://techprojects4u.blogspot.com/">This is a link</a>

NOTE=>

1.Attribute values should always be enclosed in quotes.

2.Double style quotes are the most common, but single style quotes are also allowed.

3*.In some rare situations, when the attribute value itself contains quotes, it is necessary to use single quotes.

EXAMPLE:
 name='Tech"Projects" for you'


Use Lowercase Attributes


Attribute names and attribute values are case-insensitive.
However, it is recommended that to use lowercase attributes/attribute values.

Newer versions of (X)HTML will demand lowercase attributes.


HTML Attributes Reference


List of some attributes that can be used on any HTML element:

AttributeDescription
classSpecifies one or more classnames for an element (refers to a class in a style sheet)
idSpecifies a unique id for an element
styleSpecifies an inline CSS style for an element
titleSpecifies extra information about an element (displayed as a tool tip)
                                                                                                                                     






No comments:

Post a Comment