HTML attributes provide additional information about HTML elements. HTML elements are typically represented by tags, and those tags can include one or more attributes. These attributes define an element’s behavior, appearance, and how it functions.
|
cite Referencing the Source URL |
The cite attribute specifies the source URL of a quote or change, and is used in q, blockquote, ins, and del tags. It helps authors and search engines understand the source of the quoted or modified content. |
|---|---|
|
class Specifying One or More Class Names |
The class attribute specifies one or more class names for an element. Multiple elements can share the same class names, which are used by CSS and JavaScript to classify, identify, select, style, and manipulate elements. |
|
contenteditable Making HTML Elements Editable |
The contenteditable attribute specifies whether the content of an element is editable. When set to true, the content becomes editable. When set to false, editing is disabled. |
|
crossorigin Specifying CORS Request Modes |
The crossorigin attribute specifies the CORS (Cross-Origin Resource Sharing) request mode used when fetching resources linked to an element from an external origin. |
|
data-* Standard Custom Data Attributes |
The data-* attributes are standard HTML 'custom data attributes' beyond those predefined by HTML. They are created by combining the data- prefix with a custom name, allowing you to store custom data in the attribute's value. |
|
datetime Specifying the Date and Time |
The datetime attribute specifies a machine-readable date or time for the element. It is used with the del, ins, and time tags. |
|
enterkeyhint Specifying the Enter key for virtual keyboards |
The enterkeyhint attribute explicitly specifies the text or icon label for the Enter key on virtual keyboards, allowing you to define the action label users see. |
|
hidden Indicating Hidden Elements |
The hidden attribute indicates that an element is hidden, meaning it is not visually rendered and is not accessible to screen readers. Use this attribute when the element's content should not be presented to the user. |
|
id Specifying a Unique Element Identifier |
The id attribute specifies a unique identifier (ID) for an element. The value of this attribute must be unique and distinct within the document (web page). |
|
<img> alt Specifying Alternative Text for Images |
The alt attribute of the img tag, which represents an image, specifies alternative text for the image. It is optional. |
|
<img> srcset, sizes Responsive Images with <img> |
A clear and simple guide to using the HTML <img> tag with srcset and sizes attributes for creating responsive images that adjust based on screen width and resolution. |
|
<input> type Specifies Various Input Control Types |
The input tag offers a wide range of control types based on the value of its type attribute. The behavior and appearance of the input field vary depending on the value of the type attribute. |
| <input type="button"> | The type="button" attribute of the input tag represents a button with no default behavior. It is mainly used with JavaScript to control various actions when the user clicks the button. |
| <input type="checkbox"> | The type="checkbox" attribute of the input tag represents a checkbox. It allows a single value to be checked or unchecked. It is generally square, but its corners may be rounded. |
| <input type="hidden"> | The type="hidden" attribute of the input tag represents a hidden input field containing a value that is not intended to be examined or manipulated by the user. |
| <input type="number"> | The type="number" attribute of the input tag represents a numeric input field. This field is configured to allow only numbers to be entered or selected, and has built-in validation that rejects non-numeric input. |
| <input type="password"> | The type="password" attribute of the input tag represents a single-line password input field. The browser processes sensitive information entered by replacing the text characters with symbols such as dots (•) so that they cannot be read on the screen. |
| <input type="radio"> | The type="radio" attribute of the input tag represents a radio button. It is generally used as a group of radio buttons, and only one radio button can be selected from a given group. |
| <input type="reset"> | The type="reset" attribute of the input tag represents a form reset button. Clicking this button resets the values of all controls in the form represented by the form tag that contains the element. |
| <input type="search"> | The type="search" attribute of the input tag represents a single-line search input field. This field is very similar to the basic single-line text field type, type="text", but differs in that it explicitly indicates that the input is intended for a search query. |
| <input type="submit"> | The type="submit" attribute of the input tag represents a form submit button. Clicking this button submits the values of all submittable controls in the form represented by the form tag that contains the element. |
| <input type="text"> | The type="text" attribute of the input tag represents a basic single-line text input field. The type="text" attribute is the default value of the type attribute used in the input tag and is the basic control that allows users to enter plain single-line text. |
| <input type="url"> | The type="url" attribute of the input tag represents a single-line URL input field. This field is very similar to the basic single-line text field type, type="text", but differs in that it explicitly indicates that the input is intended for a URL. |
|
inputmode Specifying the Virtual Keyboard Input Mode |
The inputmode attribute specifies the virtual keyboard input mode for input fields on devices like mobile phones and tablets. |
|
lang Specifying the Primary Language |
The lang attribute specifies the primary language of an element's content and of any text-containing attributes. |
|
rel Meaning, List, and Examples |
The rel attribute is used to specify the relationship between the current document and the linked resource. |
|
<link rel="dns-prefetch"> Prefetching DNS Information |
The rel="dns-prefetch" attribute of the link tag indicates that the browser should preemptively perform DNS resolution for the external domain specified by the href attribute and cache IP address and other information required for connection. |
|
<link rel="preconnect"> Preconnecting to External Domains |
The rel="preconnect" attribute of the link tag indicates that the browser should preemptively establish a connection to the external domain specified by the href attribute. |
|
<link rel="prefetch"> Prefetching Future Resources |
The rel="prefetch" attribute of the link tag indicates that the browser should preemptively fetch the resource specified by the href attribute and store it in the cache. |
|
<link rel="preload"> Preloading Resources |
The rel="preload" attribute of the link tag indicates that the browser should preemptively fetch the resource specified by the href attribute and store it in the cache to preload it. |
|
role A Guide to ARIA Roles & Accessibility |
The role attribute in HTML is an extension of the standard element model that adds clearer meaning and structure to HTML elements. |
|
style Applying CSS Styles Directly to an Element |
The style attribute lets you apply CSS styles directly to an element. Applying styles directly to an element using the style attribute is called "inline styling". |
|
title Advisory Information for the Element |
The title attribute represents advisory information about the element, such as guidance or descriptive notes. |