Attributes

        HTML attributes provide additional information about HTML elements and are used to modify the behavior or appearance of elements. They are always included in the opening tag and usually come in name/value pairs like this: name="value".


Common HTML Attribute

  • HTML id Attribute
  • HTML class Attribute
  • HTML src Attribute
  • HTML href Attribute
  • HTML title Attribute
  • HTML target Attribute
  • HTML style Attribute
  • HTML alt Attribute
  • HTML width and height Attribute
  • HTML value Attribute
  • HTML disabled Attribute
  • HTML lang attribute

The id Attribute


The id attribute isUniquely identifies an element.

Example
<div id="header">Header Content</div>

The class Attribute


The class attribute is Defines one or more class names for an element, which can be used by CSS or JavaScript.

Example
<p class="text-bold">Bold Text</p>

The src Attribute


The src attribute is Specifies the source of an image, script, or other external content.

Example
<img src="image.jpg" alt="Description of Image">

The href Attribute


The href Specifies the URL for a link.

Example
<a href="https://whereisstuff.com">Whereisstuff</a>

The title Attribute


The title attribute is adds extra information about the element, usually displayed as a tooltip when hovered over.

Example
<a href="https://www.example.com" title="Go to Example">Visit Example</a>

The target Attribute


The target attribute is specifies where to open a linked document.

Example
<a href="https://www.example.com" target="_blank">Open in New Tab</a>

The style Attribute


The style attribute is contains CSS styling for an element.

Example
<p style="color: red;">Red Text</p>

The alt Attribute


The alt attribute is provides alternative text for an image if it cannot be displayed.

Example
<img src="image.jpg" alt="Description of Image">

The width and height Attribute


The width and height attribute is adjust the width and height of an image in pixels.

Example
<img src="image.jpg" width="100px" height="100px">

The value Attribute


The value attribute is specifies the initial value for an input element.

Example
<input type="text" value="Enter your name">

The disable Attribute


The disable attribute is disables an input element, making it unclickable or uneditable.

Example
<button disabled>Can't Click Me</button>

The lang Attribute


The lang attribute in HTML specifies the language of the element's content. It helps search engines and browsers understand the language used in the document

Example
<html lang="en"></html>

Whereisstuff is simple learing platform for beginer to advance level to improve there skills in technologies.we will provide all material free of cost.you can write a code in runkit workspace and we provide some extrac features also, you agree to have read and accepted our terms of use, cookie and privacy policy.
© Copyright 2024 www.whereisstuff.com. All rights reserved. Developed by whereisstuff Tech.