HTML - Attributes




HTML Attributes

What is the Attribute, What is an HTML Attribute, What are the types of HTML Attributes, Types of HTML Attributes?

When using some HTML tags, they also have to add additional information about them, like; Image tag is used to insert image into HTML document, Image Tag can not insert any picture into a webpage, for this we have to tell about the image address or the source tag. This additional information is called Attribute.

The HTML attributes are used to explain the features of the HTML element.

The HTML attributes are placed inside the element’s opening tag and they are consisting of two parts namely −

A name &

A value

Following are the major core HTML attributes −

Core Attributes Example

id, title, class, style

id Attribute

HTML id attribute is a unique identifier, every id is unique in the entire HTML document.

HTML id is used for Javascript and CSS (Cascading Style Sheet).

title Attribute

With the title attribute you can specify the name of an element or give more information about it.

class Attribute

The .class selector selects elements with a specific class attribute, the class is an attribute which specifies one or more class names for an HTML element.

style Attribute

The <style> element is used to add CSS style rules to an HTML document. The element is expected to appear in the document <head>, but will also render acceptably when used in the <body> of the document.