Get Website Learn Coding Tech Story

HTML Examples

Html 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.


<h1 align="center"> Heading </h1>

Tip for Html Attributes

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.

Core Attributes

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:

classSpecifies one or more class names for an element (refers to a class in a style sheet).
idSpecifies a unique id for an element to identify in a page.
styleSpecifies an inline Casecading Style Sheet (CSS) style for an element.
titleSpecifies extra information about an element (displayed as a tool tip).

Generic Attributes

Here is some other attributes that most used with other Html's tags

alignSpecifies horizontally alignments of an element or element's content.
dirSpecifies to the browser the direction in which the text should flow.
heightSpecifies the height of an element.
valignSpecifies vertically alignments of an element or element's content.
widthSpecifies the width of an element.