DEV Community

Narmatha
Narmatha

Posted on

HTML ATTRIBUTES

WHAT IS HTML ATTRIBUTES

HTML attributes are special properties that provide additional information about an HTML element or modify its behavior and appearance. They are written inside the opening tag of an HTML element and usually have the format attribute="value".

*href Attribute *

The href (Hypertext Reference) attribute is used to specify the destination URL of a hyperlink. It is mainly used with the (anchor) tag to link one web page to another, or to files, email addresses, or sections within the same page.

Syntax
Link Text
Example
Visit Google

Common HTML Attributes

id **– Gives an HTML element a unique name or identifier. It is used to target a specific element with CSS or JavaScript.
**Example:

Welcome

*class *– Groups multiple HTML elements together so they can be styled or controlled using CSS or JavaScript.
*Example:
*

Hello

style **– Applies CSS styles directly to an HTML element (inline CSS).
**Example:

Heading

title – Provides extra information about an element and displays it as a tooltip when the mouse is placed over it.
Example:

Hello

*href *– Specifies the URL or destination of a link. It is mainly used with the tag.
*Example:
*

Visit

*src *– Specifies the source location of an image, video, or other media files. It is mainly used with tags like , , and

Top comments (0)