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="">