Category: HTML Attributes

A complete list (and brief description) of every attribute in the HTML specification, 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.

Disclosure: Your support helps keep the site running! We earn a referral fee for some of the services we recommend on this page. Learn more
Hr Color Is Deprecated In HTML5 (Replace With CSS)Was used to control the display color of a horizontal rule. Deprecated. Use CSS instead.
How Input Value Defines Default Selection Fields ValueDefines an initial value or default selection for an input field.
Table Cellpadding Is Outdated HTML: Get The New CSS Code NowWas 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.
Iframe Src: 60-Second Tutorial For Coding BeginnersSpecifies the URL of a document to display in an iframe.
Audio Autoplay: What Does It Do In HTML5? (Listen To Find Out!)Specifies that the audio playback should begin immediately on page load.
Area Shape HTML Tutorial For Beginners: Get The Code NowIn conjunction with the coords attribute, specifies the shape, size, and placement of a clickable area in an image map.
Learn How Area Coords Define Shapes & Sizes In HTMLDefines the shape and size of a clickable area in an image map.
Img Height In HTML: How Not To Use The Height AttributeIdentifies the intrinsic height of an image file, in CSS pixels.
HTML Form Code For Beginners (And When To Use It)Sets the vertical alignment of all content in a table row.
Input Disabled HTML Attribute Explained For Inexperienced CodersDisables the input field.
Textarea Onchange: Get The HTML Code To Trigger A JavaScript Event NowAdds an event listener to a <textarea> which executes JavaScript scripting when an onchange event occurs.
Stop Using To Set Table Width In HTML: Here's WhyWas 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.
HTML A Href Attribute: A Quick And Simple GuideSpecifies the linked document, resource, or location.
How To Define Input Type In HTML (All The Values And Attributes)Defines the input type.
Why Table Bgcolor Is No Longer Valid Code (And What To Use Instead)Was used to set the background color of an HTML table. This attribute has been deprecated. Use CSS to style tables.
Button Type In HTML: Here's Why You Should Always Declare ItSpecifies the type of the button.
Font Weight Is Deprecated In HTML5, But Here's The New CSSWas used to indicate the weight (boldness) of text. Deprecated. Use CSS instead.
Using Option Selected To Define A Default Selection In Drop-Down ListDefines the default selection in a drop-down list.
Tr Bgcolor Is Obsolete: Here's How To Set Table Row Background Color NowSets the background color for a single table row in an HTML table.
How To Use In HTMLSpecifies the URL of an image to be displayed.
What Does HTML Bordercolor Attribute Does To Your Tables? [Clue: Color!]Was used to specify the color of table borders. This attribute has been deprecated. Use CSS to style table borders.
Td Background: Here's The CSS To Replace The HTML Code WithSpecifies the URL of an image file to be used as the <td> element background image.
How Img Border HTML Code Gave Way To CSS: A Simple TutorialPreviously used to define a border on an image element. It has been deprecated and should no longer be used.
Why HTML5 Iframe Width Isn't The Best Option To Control SizingSpecifies the width of an iframe.
Forget About Table Cellspacing In HTML (And Learn The CSS Now)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.
Use If You Don't Want Input Value EditedDisallows the user from editing the value of the input.
Required HTML For Input Required: Get The Code NowSpecifies that the input field is required; disallows form submission and alerts the user if the required field is empty.
CSS Code Example For Font Color (And Why HTML Is Forbidden)Was used to specify font color. Deprecated. Use CSS instead.
When To Use Input Autocomplete In HTML (And When List Or Datalist)Specifies whether the browser should attempt to automatically complete the input based on user inputs to similar fields.
What Replaced Td Align After HTML5?: We've Got The Answer (And The Code)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.
Table Background To Style HTML Tables Is Out (But CSS Is In)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.
HTML Body Background: Here Are The CSS Properties To Replace It WithWas used to set the background color and image for the document. Deprecated. Use CSS instead.
HTML Tag: Change The Width Of A Picture In HTMLIndicates the intrinsic width of the image, in CSS pixels.
How To Replace Td Bgcolor With CSS Background PropertySets the background color of a single cell in a table.
Input Pattern: Use It To Add Basic Data Validation In HTML5Specifies a regular expression against which to validate the value of the input.
Audio Volume: Quick & Easy HTML Guide For Setting Initial VolumeSpecifies the initial volume setting of the audio element, in a range from 0.0 to 1.0.
What Does Td Colspan Have To Do With Tables In HTML?Indicates how many columns a cell should take up.
What Form Method Tells Your Web Browser In HTML: An Easy TutorialTells the browser how to send form data to a web server.
What Img Srcset Does In HTML5: A Quick & Simple GuideDefines multiple sizes of the same image, allowing the browser to select the appropriate image source.
HTML Img Alt Tags For SEO Best Practice - Search Engines Love ThemDefines alternate text, which may be presented in place of the image.
Using <a> To Download Rather Than Open Linked ResourceDirects the browser to download the linked resource rather than opening it.
How To Select Multiple Items In HTML: Easy Tutorial With Code ExampleLets the user select more than one option in the list
HTML Font Size Is Out (But CSS Is In): Here's How To Specify Font Size TodayWas used to specify the size of text. Deprecated. Use CSS instead.
Form Enctype HTML Code: Here's How It Specifies Form Encoding TypeThe enctype attribute lets you specify an encoding type for your form.
How Td Bordercolor Works To Set Bordercolor Around CellsSets the color of the entire border around a cell.
What Does Link Rel Do In HTML?: Get The Answer (With Code) NowSpecifies the relationship between two linked documents.
When To Use A Title [<a title>] In HTML (With Code Example)Defines the title of a link, which appears to the user as a tooltip.
Table Border: The Old (HTML) And New (CSS) Code ComparedWas used to specify whether or not borders should be applied to all table cells. This attribute has been deprecated in favor of CSS.
What Input Maxlength Does In HTML: An Easy TutorialSpecifies the maximum number of characters that can be entered in a text-type input.
How To Use The <a> To Make Links & Open Them Where You Want!Specifies the context in which the linked resource will open.
<img loop=""> Attribute: Make Videos Loop In Your HTMLPreviously used to specify the number of times a video should play, when used in conjunction with the dynsource attribute. Both attributes have been deprecated.
<a name=""> HTML AttributeDepreciated - do not use.
<applet code=""> HTML AttributeSpecified the URL of an application code file to be used in an applet. The applet element has been deprecated.
<applet codebase="""> HTML AttributeSpecified the location of a directory contain application code to be used in an applet element. The applet element has been deprecated.
<applet width=""> HTML AttributeSpecified the display width of an applet panel. The applet has been deprecated.
<applet height=""> HTML AttributeSpecified the display height of an applet panel. The applet element has been deprecated.
<applet align=""> HTML AttributeWas used to specify the alignment of an applet relative to the surrounding content. The applet element has been deprecated.
<applet vspace=""> HTML AttributeWas 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 AttributeSpecified the amount of horizontal space (margin) on both sides of an applet element. The applet element has been deprecated.
<applet border=""> HTML AttributeSpecified the border around the applet panel. The applet element has been deprecated.
<applet name=""> HTML AttributeDefined the name of an applet. The applet element has been deprecated.
<applet archive=""> HTML AttributeSpecified the URL of a JAR (Java Archive) file containing the application code for the applet. The applet element has been deprecated.
<applet mayscript=""> HTML AttributeIndicated whether an applet may access on-page JavaScript objects. The applet element has been deprecated.
<area href=""> HTML AttributeDefines the URL of the linked document or resource.
<area alt=""> HTML AttributeSpecifies alternative text for a clickable area in an image map.
<area title=""> HTML AttributeDefines the title text of the clickable area. The title text will appear as a tooltip in most browsers.
<area target=""> HTML AttributeSpecifies the context in which to open the linked resource.
<area nohref> HTML AttributeSpecified that an area of an image map did not link to another resource.
<base href=""> HTML AttributeSpecifies the base URL which will be used for all relative links in the current document.
<base target=""> HTML AttributeSpecifies the default target value for all anchor links in the current document.
<basefont size=""> HTML AttributeWas used to set the base font size for a whole document. Deprecated. Use CSS instead.
<basefont color=""> HTML AttributeUsed to set the text color for a whole document. Deprecated. Use CSS instead.
<basefont face=""> HTML AttributeWas used to set the base font face for a document. Deprecated. Use CSS instead.
<bgsound src=""> HTML AttributeSpecified the URL of the audio source file for the deprecated <bgsound> element.
<bgsound loop=""> HTML AttributeSpecified 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 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 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 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.
<form action=""">Specifies a URL to which the form's data is sent when submitted.
<form name="">The `name` attribute is deprecated when used with the `form` element. Use `id` instead.
<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.
<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.
<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 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 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 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 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 size="">Specifies the width of the input in characters.
<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 accesskey="">Defines a keyboard shortcut for the element.
<input language="">Was used to indicate the scripting language used for events triggered by the input.
<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 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="">The <multicol> element is deprecated, and should not be used. Claire Broadley Claire is seasoned technical writer, editor, and HTML… 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.
<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 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 width="">The width attribute of <table> is not supported in HTML. Use CSS to control the appearance of tables. Claire Broadley… Read More...
<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.
<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 nowrap>NOWRAP indicates that text should not wrap in the cell.
<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 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 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 crossorigin="">Indicates that CORS headers should be used in the HTTP request, and specifies whether or not to use credentials.
<a hreflang=""> HTML AttributeSpecifies the language of the linked resource.
<abbr title=""> HTML AttributeProvides the meaning or explanation of an abbreviation or acronym.
<audio src=""> HTML AttributeSpecifies the source file for an audio element.
<audio controls> HTML AttributeToggles the display of audio playback controls.
<audio loop> HTML AttributeSpecifies that the audio content should loop indefinitely once playback has begun.
<audio muted> HTML AttributeSpecifies that the volume on the audio player should initially be muted.
<audio preload=""> HTML AttributeRequests a particular preload behavior to the browser, which the browser may or may not follow.
<iframe sandbox="">Places a set of security and usability restrictions on the iframe.
<input autofocus>Specifies that the input field should be in focus immediately upon page load.
<input formaction="">Specifies the URL for form submission. Can only be used for type="submit" and type="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 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 height="">Specifies the height of an image input.
<input list="">Specifies the id of a <datalist> element which provides a list of autocomplete suggestions for the input field.
<input max="">Specifies a maximum value for number and date input fields.
<input min="">Specifies a minimum value for number and date input fields.
<input multiple>Allows the user to enter multiple values into a file upload or email input.
<input placeholder="">Specifies placeholder text in a text-based input.
<input step="">Specifies the interval between valid values in a number-based input.