HTML Attributes

Standard HTML Attributes

Attributes provide additional information about HTML elements.

  1. HTML elements can have attributes.
  2. Attributes provide additional information about the element.
  3. Attributes are always specified in the start tag.
  4. Attributes come in name/value pairs like: name=”value”.

Defining Attribute Values

Attribute values should always be enclosed within quotation marks. While “double quotes” are the most common, single-style quotes (also called primes) are also allowed. In some rare situations, like when the attribute value itself includes quotation marks, it is necessary to use primes. For example: name=”John”
Consider the HTML example of an <a> (link) tag, as :

<html>
<head>
<title>
HTML Links
</title>
</head>
<body>
<a href="http://www.loopandbreak.com">Ayunor Learning</a>
</body>
</html>

In the above example href=”http://www.loopandbreak.com” is a attribute which defines the page on click, which page is called.

HTML Attributes Reference

There are many attributes with html tags, some of the common with thier HTML tags are defined as :-
<applet>: code, object
<area>: nohref
<body>: alink, background, link, text, vlink
<dir>: dir
<form>: accept-charset, action, enctype, method
<frame>: noresize
<head>: profile
<hr>: noshade
<html>: xmlns
<img>: ismap
<input>: checked, maxlength
<label>: for
<meta>: content, http-equiv, scheme
<object>: classid, codetag, data, declare, standby
<ol>: start
<option>: selected
<param>: valuetype
<script>: defer, xml:space
<select>: multiple
<table>: cellpadding, cellspacing, frame, rules, summary
<td>: headers