Attributes
Web page customization begins with Html attributes. Attributes are another important part of Html. An attribute is used to define the characteristics of an element, its provide additional information about an element. Attribute placed inside the element's opening tag and guides web browser for the construction of web elements. Without any attribute values specified, the browser will render the element using the default setting(s). All attributes are made up of two parts: name and value
Name is the property that you need to set. For example, the <h1> element in the example carries an attribute whose name is align, which use to mention the alignment of heading.
Value is what you need to set the attribute property to be. As per the previous example, "center" is one of value of the align attribute to set the alignment of the heading in the middle.
Attribute names and attribute values are case-insensitive. Use Lowercase for Attributes and its value.
Attribute names and values should be separated by the equals sign.
Attribute values should always be enclosed in double quotes.
Many Html tags have a unique set of their own attributes. These will be discussed as each tag is introduced throughout the tutorial. Now, lets focus on a set of some attributes that can be used on any Html element:
Attribute | Description |
---|---|
class | Specifies one or more class names for an element (refers to a class in a style sheet). |
id | Specifies a unique id for an element to identify in a page. |
style | Specifies an inline Casecading Style Sheet (CSS) style for an element. |
title | Specifies extra information about an element (displayed as a tool tip). |
Here is some other attributes that most used with other Html's tags
Attribute | Description |
---|---|
align | Specifies horizontally alignments of an element or element's content. |
dir | Specifies to the browser the direction in which the text should flow. |
height | Specifies the height of an element. |
valign | Specifies vertically alignments of an element or element's content. |
width | Specifies the width of an element. |