Class – 15 | HTML Attributes | HTML Tutorial

HTML Attributes - Class - 15
HTML Attributes – Class – 15

HTML Attributes are special keywords used inside the HTML tags to provide additional information about an HTML element. Attributes are always specified in the start tag and usually come in name/value pairs like: name=”value”.

Here’s a list of some of the most commonly used HTML attributes:

class – Specifies a class name for an element (used to select elements with CSS and JavaScript)

id – Specifies a unique id for an element (used to select a specific element with CSS and JavaScript)

style – Specifies inline styling information for an element

src – Specifies the source URL of an embedded content, such as an image or a video

width and height – Specifies the width and height of an element, such as an image

alt – Specifies alternative text for an image, to be displayed if the image cannot be loaded

href – Specifies the target URL of a link

target – Specifies where to open a linked document or resource, such as _blank for a new tab or _self for the same tab

method – Specifies the HTTP method to be used when submitting a form, such as “get” or “post”

action – Specifies the URL to which the form data will be sent when the form is submitted.

There are many more HTML attributes, but these are some of the most commonly used ones. It’s important to note that not all attributes are applicable to all HTML elements, and different elements may require different attributes.

Next Class

Leave a Comment