0% found this document useful (0 votes)
19 views

6 Attributes

Attributes provide additional information about HTML elements. Attributes are always specified in the start tag and come in name/value pairs like name="value". Common attributes include class, id, style, and title. Attribute values should always be enclosed in quotes and the W3C recommends using lowercase attributes and values.

Uploaded by

ManishKumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

6 Attributes

Attributes provide additional information about HTML elements. Attributes are always specified in the start tag and come in name/value pairs like name="value". Common attributes include class, id, style, and title. Attribute values should always be enclosed in quotes and the W3C recommends using lowercase attributes and values.

Uploaded by

ManishKumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

HTML Attributes

Previous
Next Chapter
Attributes provide additional information about HTML elements.

HTML Attributes

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.w3schools.com">This is a link</a>
Try it yourself

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.
Tip: In some rare situations, when the attribute value itself contains quotes, it is necessary
to use single quotes: name='John "ShotGun" Nelson'

HTML Tip: 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


A complete list of legal attributes for each HTML element is listed in our: HTML Tag Reference.
Below is a list of some attributes that can be used on any HTML element:
Attribute
class
id
style
title

Description
Specifies one or more classnames for an element (refers to a class in a style sheet)
Specifies a unique id for an element
Specifies an inline CSS style for an element
Specifies extra information about an element (displayed as a tool tip)

For more information about global attributes: HTML Global Attributes Reference.

You might also like