HTML Attributes

By: Dusty Arlia
Published on February 2, 2013
Last Updated on Friday, July 10, 2015 at 11:25 PM
Total Updates: 4

HTML elements sometimes contain attributes within the angle brackets (< >) of their opening tag after the element name. If the HTML element has no closing tag (called a void element or self-closing element) then the attributes appear between the angle brackets as usual. HTML attributes generally appear as name-value pairs, separated by a "=" with the value in double quotation marks (" "). The actual attribute name itself is case insensitive. Here is an example of the basic syntax of a tag with an attribute:

<tag_name attribute_name="attribute_value">The contents of the element.</tag_name>

Attributes provide additional information about the encapsulated content. Some attributes are generic and can be used with all tags (global HTML attributes), while others are specific to certain elements. The <img ... /> tag, for example, uses the src attribute to specify the URL of the image. The browser will load and render the image using the browser's rendering engine. Look at this example of the src attribute in use.

Comments:

Ad:

Ad: