Category: HTML Attributes

A complete list (and brief description) of every attribute in the HTML, including the latest additions in HTML5. Click through to view details, code samples and more for each attribute.

Be sure to check out our HTML tags section, too.

<input step=””> Specifies the interval between valid values in a number-based input.
<input required> Specifies that the input field is required; disallows form submission and alerts the user if the required field is empty.
<input readonly> Disallows the user from editing the value of the input.
<input placeholder=””> Specifies placeholder text in a text-based input.
<input pattern=””> Specifies a regular expression against which to validate the value of the input.
<input multiple> Allows the user to enter multiple values into a file upload or email input.
<input min=””> Specifies a minimum value for number and date input fields.
<input max=””> Specifies a maximum value for number and date input fields.
<input list=””> Specifies the id of a <datalist> element which provides a list of autocomplete suggestions for the input field.
<input height=””> Specifies the height of an image input.
<input formtarget=””> Specifies the browsing context in which to open the response from the server after form submission. For use only on input types of "submit" or "image".
<input formmethod=” Specifies the HTTP method (GET or POST) to be used when the form data is submitted to the server. Only for use on input types of "submit" or "image".
<input formaction=””> Specifies the URL for form submission. Can only be used for type="submit" and type="image".
<input autofocus> Specifies that the input field should be in focus immediately upon page load.
<iframe sandbox=””> Places a set of security and usability restrictions on the iframe.
<audio volume=””> HTML Attribute Specifies the initial volume setting of the audio element, in a range from 0.0 to 1.0.
<audio preload=””> HTML Attribute Requests a particular preload behavior to the browser, which the browser may or may not follow.
<audio muted> HTML Attribute Specifies that the volume on the audio player should initially be muted.
<audio loop> HTML Attribute Specifies that the audio content should loop indefinitely once playback has begun.
<audio controls> HTML Attribute Toggles the display of audio playback controls.
<audio autoplay> HTML Attribute Specifies that the audio playback should begin immediately on page load.
<audio src=””> HTML Attribute Specifies the source file for an audio element.
<abbr title=””> HTML Attribute Provides the meaning or explanation of an abbreviation or acronym.
<a hreflang=””> HTML Attribute Specifies the language of the linked resource.
<a download> HTML Attribute Directs the browser to download the linked resource rather than opening it.
<img crossorigin=””> Indicates that CORS headers should be used in the HTTP request, and specifies whether or not to use credentials.
<img height=””> Identifies the intrinsic height of an image file, in CSS pixels.
<img srcset=””> Defines multiple sizes of the same image, allowing the browser to select the appropriate image source.
<td nowrap> NOWRAP indicates that text should not wrap in the cell.
<td bgcolor=””> Sets the background color of a single cell in a table.
<td bordercolor=””> Sets the color of the entire border around a cell.
<td background=””> Specifies the URL of an image file to be used as the <td> element background image.
<textarea name=””> Adds a name attribute to a <textarea> element and associates the name with the text added to the text area.
<textarea cols=””> Specifies the visible width of a <textarea> element in average character widths. Defaults to 20 if not specified.
<textarea wrap=””> Determines whether or not submitted text wraps when a <textarea> is included in a form submission.
<textarea disabled> Disables the entry of text into a <textarea> element.
<textarea tabindex=”””> Sets the position of a <textarea> element in the tab order.
<textarea onChange=””> Adds an event listener to a <textarea> which executes JavaScript scripting when an onchange event occurs.
<textarea onKeyPress=””> Adds an event listener to a <textarea> element which executes JavaScript scripting when an onKeyPress event occurs.
<tr align=””> Sets the horizontal alignment for the contents of each <td> element in a table row.
<tr valign=””> Sets the vertical alignment of all content in a table row.
<tr bgcolor=””> Sets the background color for a single table row in an HTML table.
<tr background=””> Identifies the URL of a file to be used as a background image for a table row.
<tr bordercolor=””> Sets the border color for all inside borders of a table row.
<ul type=””> Was used to set list types.
<img alt=””> Defines alternate text, which may be presented in place of the image.
<img name=””> Identified the image or provided additional information about it. Deprecated in HTML 4.0 in favor of other attributes.
<img longdesc=””> Defines a URL at which can be found more information about the image. It was written out of the HTML5 specification, but its status is not quite so clear as other deprecated features.
<img width=””> Indicates the intrinsic width of the image, in CSS pixels.
<img align=””> Was previously used to specify the alignment and placement of an image relative to the surrounding text. It has been deprecated and should not be used.
<img border=””> Previously used to define a border on an image element. It has been deprecated and should no longer be used.
<img hspace=””> Previously used to add horizontal space on both side of an image. It is now deprecated.
<img ismap> Identifies an image as a server-side image map. When the containing anchor link is clicked, the coordinates of the mouse will be included in the request.
<img usemap=””> Specifies a client-side image map to be used with the image.
<img lowsrc=””> Specified a smaller or lower-quality version of an image.
<img naturalsizeflag=””> This attribute does nothing. It was once used by a proprietary software system.
<img nosave> Was intended to prevent users from downloading an image. Was never a part of the HTML specification, and not widely implemented.
<img dynsrc=””> An early failed attempt to include native video playback in HTML.
<img controls> Toggled media player controls when used in conjunction with the dynsrc attribute. Both attributes are now deprecated.
<img loop=””> Previously used to specify the number of times a video should play, when used in conjunction with the dynsource attribute. Both attributes have been deprecated.
<img start=””> Was used in conjunction with the dynsrc attribute to add a video that would load in supported browsers in the place of the image that would otherwise be displayed.
<img suppress=””> Used by the now-defunct Netscape browser to suppress the display of image prior to image download completion.
<input type=””> Defines the input type.
<input name=””> Specifies the name of an input element. The name and value of each input element are included in the HTTP request when the form is submitted.
<input value=””> Defines an initial value or default selection for an input field.
<input size=””> Specifies the width of the input in characters.
<input maxlength=””> Specifies the maximum number of characters that can be entered in a text-type input.
<input checked> Specifies whether a checkbox or radio button form input should be checked by default.
<input border=””> Was used to specify a border on an input. Deprecated. Use CSS instead.
<input src=””> Defines the source URL for an image input.
<input disabled> Disables the input field.
<input accesskey=””> Defines a keyboard shortcut for the element.
<input language=””> Was used to indicate the scripting language used for events triggered by the input.
<input autocomplete=””> Specifies whether the browser should attempt to automatically complete the input based on user inputs to similar fields.
<isindex prompt=””> Specifies a label or prompt text for the document search form.
<isindex action=””> Specifies a URL to search, instead of the current document.
<label for=””> Specifies the ID of the associated form field element.
<legend align=””> Was used to specify the placement of the legend element. Deprecated. Use CSS instead.
<li type=””> Specifies the bullet or numbering style for an individual list item.
<li value=””> Specifies the counter value for a list item within a numbered list.
<link rel=””> Specifies the relationship between two linked documents.
<link href=””> Describes the relationship between the source file and an external file, such as a script.
<link title=””> Assigns a name to different linked resources so that users can choose between them.
<link media=””> Tells the browser what type of device a resource is designed for.
<link type=””> Describes the linked resource's media type (MIME type).
<map name=””> Assigns a name to an image map.
<meta name=””> Provides a context for the value in the contents attribute of a <meta> element.
<meta http-equiv=””> Defines document header information.
<meta content=””> Defines the values for the meta element.
<multicol cols=””> OIOpublisher The <multicol> element is deprecated, and should not be used. Claire Broadley Claire is seasoned technical writer, editor and… Read More...
<multicol gutter=””> The <multicol> element is deprecated, and should not be used. Claire Broadley Claire is seasoned technical writer, editor and HTML… Read More...
<multicol width=””> The <multicol> element is deprecated, and should not be used. Claire Broadley Claire is seasoned technical writer, editor and HTML… Read More...
<ol type=””> Specifies the type of list marker that should be used on each item of an unordered list.
<ol start=””> Defines the starting number in an ordered list.
<option value=””> Defines the data sent to the server when a form option item is selected.
<option selected> Defines the default selection in a drop-down list.
<p clear=””> Was used to force a paragraph to appear below sibling elements rather than next to sibling elements within a parent element.
<param name=””> Specifies the parameter name.
<param value=””> Specifies the parameter value.
<script type=””> Specifies the media type of the script.
<script src=””> Specifies the URL of an external script.
<script defer> The defer element of <script> allows a script to load, but pauses the execution of the script until the page… Read More...
<script language=””> The language attribute of <script> was intended as a way to define the scripting language in use. This was never… Read More...
<script for=””> The for attribute of <script> was only supported by Internet Explorer, and is therefore non-standard. We do not recommend its… Read More...
<select name=””> Naming Selection Items The name attribute of <select> means you can easily use your selection field with JavaScript. For more… Read More...
<select multiple> Lets the user select more than one option in the list
<select size=””> Specifies the size of a select item.
<select readonly> <readonly> is not valid in HTML. Use the disabled attribute. Claire Broadley Claire is seasoned technical writer, editor and HTML… Read More...
<select disabled> Disables a drop-down list.
<select language=””> The language attribute of <select> is not valid HTML. Instead, use <script> with a valid type attribute. Claire Broadley Claire… Read More...
<select onChange=””> Triggers an event when the selection is changed.
<select tabindex=””> Defines the order of selection when the tab key is pressed.
<select onFocus=””> Triggers an event when a select item receives focus.
<spacer type=””> Do not use. The <spacer> element is obsolete in HTML 5. TYPE sets the type of spacer to use. TYPE… Read More...
<spacer align=””> Do not use. The <spacer> element is obsolete in HTML5. Claire Broadley Claire is seasoned technical writer, editor and HTML… Read More...
<spacer size=””> Do not use. The <spacer> element is obsolete in HTML 5. Claire Broadley Claire is seasoned technical writer, editor and… Read More...
<spacer width=””> Do not use. The <spacer> element is obsolete in HTML 5. Claire Broadley Claire is seasoned technical writer, editor and… Read More...
<style type=””> Identifies the type of media contained within a <style> element. However, the only supported value is text/css, so the attribute is not needed.
<style media=””> Identifies the device or media that the styles contained in a <style> are designed to be applied to. Allows CSS styles to be optimized for a variety of devices and media formats.
<table border=””> Was used to specify whether or not borders should be applied to all table cells. This attribute has been deprecated in favor of CSS.
<table cellpadding=””> Was used to add padding between the contents of each table cell and the border or edge of the cell. This attribute has been deprecated and CSS should be used instead.
<table cellspacing=””> Was used to specify the distance between the individual cells of an HTML table. This element has been deprecated and CSS should be used to control table layout.
<table width=””> The width attribute of <table> is not supported in HTML. Use CSS to control the appearance of tables. Claire Broadley… Read More...
<table bgcolor=””> Was used to set the background color of an HTML table. This attribute has been deprecated. Use CSS to style tables.
<table background=””> Was used to specify the URL of an image to be set as the background for an HTML table. This element has been deprecated. Use CSS to style HTML tables.
<table align=””> Was used to align an HTML table to the left, right, or centered relative to the parent element. This attribute has been deprecated and CSS should be used to control the position of a table.
<table hspace=””> hspace is not a valid attribute of <table>. Use CSS instead. Claire Broadley Claire is seasoned technical writer, editor and… Read More...
<table height=””> The height attribute of <table> is not valid in any version of HTML. Use CSS instead. Claire Broadley Claire is… Read More...
<table frame=””> The frame attribute was used to define the visible borders of a table. It is now deprecated and should no longer be used.
<table rules=””> Was used to specify the display of internal borders between rows and colums. This attribute has been deprecated. Use CSS to style table borders instead.
How to Use the <table bordercolor=””> Attribute Was used to specify the color of table borders. This attribute has been deprecated. Use CSS to style table borders.
<table summary=””> The summary attribute of <table> was designed to support non-visual HTML readers, such as screen readers. It is deprecated in… Read More...
<td align=””> Was used to specify the alignment of the contents of a single table data cell. This attribute has been deprecated. Use CSS to control alignment of the contents of a table data cell.
<td width=””> Was used to set the width of a table data cell to a value that would override the default width. This attribute has been deprecated. Use CSS to control layout of data cells in HTML tables.
<td colspan=””> Indicates how many columns a cell should take up.
<a href=””> HTML Attribute Specifies the linked document, resource, or location.
<a name=””> HTML Attribute Depreciated - do not use.
<a target="" > HTML Attribute Specifies the context in which the linked resource will open.
<a title=””> HTML Attribute Defines the title of a link, which appears to the user as a tooltip.
<applet code=””> HTML Attribute Specified the URL of an application code file to be used in an applet. The applet element has been deprecated.
<applet codebase=”””> HTML Attribute Specified the location of a directory contain application code to be used in an applet element. The applet element has been deprecated.
<applet width=””> HTML Attribute Specified the display width of an applet panel. The applet has been deprecated.
<applet height=””> HTML Attribute Specified the display height of an applet panel. The applet element has been deprecated.
<applet align=””> HTML Attribute Was used to specify the alignment of an applet relative to the surrounding content. The applet element has been deprecated.
<applet vspace=””> HTML Attribute Was used to specify the amount of whitespace that should appear above and below an embedded <applet> element. Applets and the vspace attribute have been deprecated.
<applet hspace=””> HTML Attribute Specified the amount of horizontal space (margin) on both sides of an applet element. The applet element has been deprecated.
<applet border=””> HTML Attribute Specified the border around the applet panel. The applet element has been deprecated.
<applet name=””> HTML Attribute Defined the name of an applet. The applet element has been deprecated.
<applet archive=””> HTML Attribute Specified the URL of a JAR (Java Archive) file containing the application code for the applet. The applet element has been deprecated.
<applet mayscript=””> HTML Attribute Indicated whether an applet may access on-page JavaScript objects. The applet element has been deprecated.
<area href=””> HTML Attribute Defines the URL of the linked document or resource.
<area alt=””> HTML Attribute Specifies alternative text for a clickable area in an image map.
<area shape=””> HTML Attribute In conjunction with the coords attribute, specifies the shape, size, and placement of a clickable area in an image map.
<area coords=””> HTML Attribute Defines the shape and size of a clickable area in an image map.
<area title=””> HTML Attribute Defines the title text of the clickable area. The title text will appear as a tooltip in most browsers.
<area target=””> HTML Attribute Specifies the context in which to open the linked resource.
<area nohref> HTML Attribute Specified that an area of an image map did not link to another resource.
<base href=””> HTML Attribute Specifies the base URL which will be used for all relative links in the current document.
<base target=””> HTML Attribute Specifies the default target value for all anchor links in the current document.
<basefont size=””> HTML Attribute Was used to set the base font size for a whole document. Deprecated. Use CSS instead.
<basefont color=””> HTML Attribute Used to set the text color for a whole document. Deprecated. Use CSS instead.
<basefont face=””> HTML Attribute Was used to set the base font face for a document. Deprecated. Use CSS instead.
<bgsound src=””> HTML Attribute Specified the URL of the audio source file for the deprecated <bgsound> element.
<bgsound loop=””> HTML Attribute Specified whether the audio track defined in the deprecated <bgsound> element should loop.
<body bgcolor=””> Was used to set the background color on a document. Deprecated. Use CSS instead.
<body background=””> HTML Attribute Was used to set the background color and image for the document. Deprecated. Use CSS instead.
<body text=””> Was used to style the text inside the body of the document. Deprecated. Use CSS.
<body bgproperties=””> Was used to style the background of a document. Deprecated. Use CSS instead.
<body topmargin=””> Was used to set a margin above the body of a document. Deprecated. Use CSS.
<body onLoad=””> Fires a script when the page has finished loading.
<body onUnload=””> Fires a script when the visitor leaves the page.
<body onFocus=””> Fires a script when the visitor focuses on the current page.
<body stylesrc=””> Was a proprietary attribute for the Frontpage system. Do not use.
<body scroll=””> Was used to toggle the display of scroll bars on a page, disabling the user's ability to scroll. Deprecated. You could use CSS to accomplish this, but you should not because it is a bad idea.
<br clear=”””> Was used to ensure that line breaks "cleared" floated or aligned elements above them. Deprecated.
<button type=””> Specifies the type of the button.
<button onClick=””> Runs a script when a button is clicked.
<button name=””> Defines the name of the button, which is used for form inputs and labels.
<button value=””> Sets the initial value of the button element.
<button disabled> Disables the button. It cannot be clicked and usually appears gray.
<button accesskey=””> Defines an keyboard shortcut for the button. As of HTML5, this is a global attribute that can be used on any element.
<button tabindex=””> Determines the order of selection when the tab key is used.
<caption align=””> Was used to control the horizontal alignment of a table caption. Deprecated. Use CSS instead.
<caption valign=””> Was used to control the vertical alignment of a table caption. Deprecated. Use CSS.
<col span=””> Specifies the number of natural vertical columns to be included in the <col> element.
<col align=””> Was used to control the alignment of text within table columns. Deprecated. Use CSS instead.
<col width=””> Was used to control the width of table columns. Deprecated. Use CSS instead.
<col bgcolor=””> Was used to control the background color of table columns. Deprecated. Use CSS instead.
<colgroup span=””> Specifies the number of vertical table columns to be included in a column group.
<colgroup align=””> Was used to control the text alignment within a column group in a table. Deprecated. Use CSS.
<colgroup width=””> Was used to specify the width of a group of table columns. Deprecated. Use CSS instead.
<div align=””> Was used to specify the alignment of a div element. Deprecated. Use CSS instead.
<dl compact> Was used to specify a compact display style for a description list. Deprecated. Use CSS instead.
<embed src=””> Specifies the URL of an application to be embedded.
<embed width=””> Specifies the width of an embedded application panel.
<embed align=””> Was used to control the alignment of an embedded application. Not a part of the HTML specification.
<embed name=””> Was used to define the name of an embedded application. Not a part of the HTML specification.
<embed pluginspage=””> Was used to indicate a download source for a plugin required in order to run the embedded application. Not a part of the HTML specification.
<embed pluginurl=””> Was used as part of a proprietary specification for embedded applications. Not a part of the HTML specification.
<embed hidden> Hides the element from view.
<embed href=””> Was used to define a link resource for an embedded application. Not a part of the HTML specification.
<embed autostart=””> Was used to start embedded audio playback immediately. Not a part of the HTML specification.
<embed loop=””> Was used to loop playback of embedded media. Not part of the HTML specification.
<embed playcount=””> Was used to specify the number of times an embedded media file should play. Not a part of the HTML specification.
<embed volume=””> Was used to specify the playback volume of an embedded application. Not a part of the HTML specification.
<embed controls=””> Was used to toggle the display of playback controls in embedded media. Not a part of the HTML specification.
<embed controller=””> Was used to toggle display of playback controls. Not a part of the HTML specification.
<embed mastersound> Was used to control sound in embedded media. Not part of the HTML specification.
<embed starttime=””> Was used to indicate the starting playback position for embedded media. Not a part of the HTML specification.
<font size=””> Was used to specify the size of text. Deprecated. Use CSS instead.
<font color=””> Was used to specify font color. Deprecated. Use CSS instead.
<font face=””> Was used to specify a typeface. Deprecated. Use CSS instead.
<font point-size=””> Was used to specify the size of text. Deprecated. Use CSS instead.
<font weight=””> Was used to indicate the weight (boldness) of text. Deprecated. Use CSS instead.
<form action=”””> Specifies a URL to which the form's data is sent when submitted.
<form method=””> Tells the browser how to send form data to a web server.
<form name=””> The `name` attribute is deprecated when used with the `form` element. Use `id` instead.
<form enctype=””> The enctype attribute lets you specify an encoding type for your form.
<form target=””> Specifies the browser context in which the form's response should be displayed.
<form onSubmit=””> Runs a script when the Submit button is clicked.
<form onReset=””> Runs a script when the Reset button is clicked.
<frame src=””> Defined the source URL for a frame. Frames are deprecated in HTML5.
<frame name=””> Defined the name of a frame. Frames are deprecated in HTML5.
<frame scrolling=””> Was used to control scrolling behavior inside frames. Frames are deprecated in HTML5.
<frame noresize=””> Was used to stop users from resizing frames within a browser window. Frames are deprecated in HTML5.
<frame frameborder=””> Was used to control the borders around frames. Frames are deprecated in HTML5.
<frame bordercolor=””> Specified the color of a frame border. Frames are deprecated in HTML5.
<frame marginwidth=””> Was used to control the margins of a frame. Frames are deprecated in HTML5.
<frameset cols=””> Was used to control display columns in a frameset. Frames and framesets are deprecated in HTML5.
<frameset frameborder=””> Was used to control borders between frames in a frameset. Frames are deprecated in HTML5.
<frameset bordercolor=””> Was used to specify the color of borders between frames in a frameset. Frames and framesets are deprecated in HTML5.
<h* align=””> Was used to specify text alignment (justification) on headline elements. Deprecated in HTML5. Use CSS instead.
<hr noshade> Was used to change the display of a horizontal rule form the default 3D style to a flatter 2D style. Deprecated. Use CSS to control the display of an element.
<hr size=””> Was used to specify the height (thickness) of a horizontal rule. Deprecated. Use CSS instead.
<hr width=””> Was used to specify the width of a horizontal rule. Deprecated in HTML5. Use CSS instead.
<hr align=””> Was used to control the horizontal alignment of a horizontal rule. Deprecated. Use CSS instead.
<hr color=””> Was used to control the display color of a horizontal rule. Deprecated. Use CSS instead.
<iframe src=””> Specifies the URL of a document to display in an iframe.
<iframe width=””> Specifies the width of an iframe.
<iframe name=””> Specifies the name of an iframe.
<iframe longdesc=””> Was used to specify URL containing a long description of an iframe. Deprecated in HTML5. Use CSS instead.
<iframe frameborder=””> Was used to toggle the display of a border around an iframe. Deprecated in HTML5. Use CSS instead.
<iframe marginwidth=””> Was used to control the width of margins around an iframe. Deprecated in HTML5. Use CSS instead.
<iframe scrolling=””> Was used to toggle scrolling on iframes. Deprecated in HTML5. Use CSS instead.
<iframe align=”””> Was used to set the alignment of an inline frame relative to surrounding elements. Deprecated. Use CSS instead.
<iframe vspace=””> Was used to control the vertical spacing around an iframe. Deprecated in HTML5. Use CSS instead.
The <img src=””> HTML Tag Specifies the URL of an image to be displayed.