HTML Attributes Complete Reference

HTML Attributes: HTML attributes are the special words placed inside the opening tags and used to define the characteristics of an HTML element. The HTML attributes contain two parts, attribute name, and its value. The attribute pairs (attribute_name, attribute_value) are separated using equal (=) operator. The attribute value is closed inside double quotes (” “). 

The complete list of HTML attributes are given below:

Example: This example shows the basic use of HTML attributes.

HTML




<!DOCTYPE html>
<html>
<body>
    <center>
        <h1 style="color:green;font-style:italic;">
            w3wiki
        </h1>
        <h2 style="color:green;font-style:italic;">
            maxlength attribute
        </h2>
        <form action="">
            Username:
            <input type="text" name="username" maxlength="12">
            <br><br>
  
            Password:
            <input type="text" name="password" maxlength="10">
            <br><br>
  
            <input type="submit" value="Submit">
        </form>
    </center>
</body>
</html>


Output:

 

HTML Attributes: The complete list of HTML attributes are given below. is used to set visible border width to most HTML elements within the body.

Attributes:

Description

Example

accept This attribute can be used with <input> element only.
Try

accept-charset Define character encoding and is used for form submission.
Try

accesskey The keyboard shortcuts to activate/focus specific elements.
Try

action Specify where the form data is to be sent to the server after submission of the form.
Try

align Specify the alignment of text content of The Element.
Try

alt Show or display something if the primary attribute
Try

async Only works for external scripts (and used only in when src attribute is present ).
Try

autocomplete Specify whether the input field has autocompleted would be on or off.
Try

autoplay The audio/video should automatically start playing when web page is loaded.
Try

autofocus The element should get focused when the page loads. It is a boolean attribute.
Try

bgcolor Set the background color of an HTML element.
Try

border Set visible border width to most HTML elements within the body.
Try

charset Define character encoding.
Try

checked Indicate whether an element should be checked when the page loads up. It is a Boolean attribute.
Try

cite Specify the URL of the document that explains the quotes, message or text which describes why the text was inserted.
Try

Class Specifies one or more class names for an HTML element.
Try

cols The number of columns a cell should span.
Try

colspan HTML specifies the number of columns a cell should span.
Try

content The values that are related to the http-equiv or name attribute.
Try

contenteditable Specify whether the content present in the element is editable or not.
Try

controls It is a Boolean attribute and also new in HTML5
Try

coords Specify the coordinate of an area in an image-map
Try

data Specify the URL of the Embedded file of the Object.
Try

data-* Specific to HTML5 and you can use the data-* attribute on all HTML elements.
Try

datetime Specify the date and time of the inserted and the deleted text.
Try

default  Specify that the track will be enabled if the user’s preferences do not indicate that another track would be more appropriate.
Try

defer Executed when the page has finished parsing.
Try

dir The text direction of the element content.
Try

dirname Enable the text direction of the input and the Textarea Field after submitting the form.
Try

disabled The disabled attribute in HTML indicates whether the element is disabled or not.
Try

download Download the element when the user clicks on the hyperlink
Try

draggable Specify whether an element is draggable or not.
Try

dropzone Specify whether the dragged data is copied, moved, or linked when it is dropped on any element.
Try

enctype That data will be present in the form and should be encoded when submitted to the server.
Try

for For Attribute is used in both the <label> and the <output> element.
Try

form That the element can contain one or more forms
Try

formaction Specify where to send the data of the form. After submission of the form, the formaction attribute is called.
Try

headers The HTML headers attribute specifies one or additional header cells a table cell is expounded to.
Try

height height attribute is used to specify the height of the Element.
Try

hidden The hidden attribute in HTML is used to define the visibility of elements.
Try

high The range where the value of gauge is considered to be of high value.
Try

href It is used to specify the URL of the document.
Try

hreflang The language for a linked document. It is used only when the href attribute is set.
Try

http-equiv Provide header information or value of the content Attribute.
Try

Id It is used by CSS and JavaScript to perform a certain task for a unique element.
Try

ismap The HTML ismap attribute is a boolean attribute.
Try

kind The kind of track. This attribute is only used in <Track> element.
Try

label The title of the Text Track is used by the browser when listing available text tracks.
Try

lang Specify the language of the element content.
Try

list List of pre-defined options for an <input> element to suggest the user.
Try

loop Restart the audio and video again and again after finishing it. It contains the Boolean value.
Try

low The range where the value of gauge is considered to be low.
Try

max Specifies the maximum value of an element.
Try

maxlength The maximum number of characters in the <input> element. Its default value is 524288.
Try

media Specify the media or device the coupled document is optimized for.
Try

method The HTTP method is used to send data while submitting the form.
Try

min Specify the lower bound of the gauge.
Try

multiple Allowed to select more than one value that is present in an element.
Try

muted The audio output of the video is muted, it is a Boolean attribute.
Try

name Specify a name for the element.
Try

novalidate That the form-data should not be validated when submitting the form.
Try

onblur That moment when the element loses focus.
Try

oncopy The user copied the content present in an element.
Try

oncut The user cut or delete the content that has been present in the element.
Try

onkeypress when a user presses a key on the Keyboard.
Try

onmousedown Order of events occurs related to the onmousedown event.
Try

onscroll This onscroll attribute works when an element scrollbar is being scrolled.
Try

optimum The optimum attribute in HTML indicates the optimal numeric value for the gauge.
Try

pattern Specifies a short hint that describes the expected value of an input field/text area.
Try

placeholder Specifies a short hint that describes the expected value of an input field/text area.
Try

readonly Specify that the text written in input or text area Element is read-only.
Try

required Specify that the input element must be filled out before submitting the Form.
Try

reversed Ordered the list in Descending Order(9, 8, 7, 6 …..) instead of ascending order(1, 2, 3 ….)
Try

rows The number of visible text lines for the control i.e the number of rows to display.
Try

rowspan The number of rows a cell should span.
Try

selected Specify which option should be by default selected when the page loads.
Try

size Specify the initial width for the input field and a number of visible rows for the select element.
Try

spellcheck Applied to HTML forms using the spellcheck attribute.
Try

srclang Specify the language of the track text.
Try

start The start value for numbering the individual list item.
Try

step Set the discrete step size of the <input> element.
Try

style There are 3 ways of implementing style in HTML.
Try

tabindex When the tab button is used for navigating.
Try

target Specify where to open the linked document.
Try

title Specify extra information about the element.
Try

translate Specify whether the content of an element is translated or not.
Try

value Specify the value of the element with which it is used.
Try

wrap Specify in which manner the text is to be wrapped in a text area when a form is submitted.
Try



Contact Us