HTML Attributes
HTML Attributes
- Provide additional information about HTML elements.
- All HTML elements can have attributes.
- Are always specified in the start tag.
- Usually come in name/value pairs like: name="value".
Use Lowercase Attributes
Quote Attribute Values
- We recommends quotes in HTML, and demands quotes for stricter document types like XHTML.
- Using quotes are the most common. Omitting quotes can produce errors. We always use quotes around attribute values.
- Double quotes around attribute values are the most common in HTML, but single quotes can also be used.
- In some situations, when the attribute value itself contains double quotes, it is necessary to use single quotes. Or vice versa. <p title='John "ShotGun" Nelson'>.
Related concepts
→
HTML Attributes
→
- HTML Links
- The href Attribute
- The src Attribute
- The width and height Attributes
- The alt Attribute
- The style Attribute
- The lang Attribute
- The title Attribute
- HTML Attributes: Use Lowercase Attributes
- HTML Attributes: Quote Attribute Values
- The id Attribute
- The target Attribute
- The target Attribute: _blank
- The target Attribute: _self
- The target Attribute: _parent
- The target Attribute: _top
- The target Attribute: framename
- <map>
- <source>
- <img>
- The colspan Attribute
- The rowspan Attribute
- The start Attribute
- <div>
- <span>
- The id Attribute: Using The id Attribute in JavaScript
- The id Attribute: Difference Between Class and ID
- The class Attribute
- The class Attribute: Using The class Attribute in JavaScript
- HTML Iframes
- The HTML <script> Tag
- The charset Attribute
- Differences from HTML: XHTML Attributes
- The action Attribute
- The method Attribute
- The name Attribute
- <input>
- <select>
- <textarea>
- <button>
- HTML5 <datalist>
- Input Type Submit
- Input Type Range
- Input Attributes
- The value Attribute
- The readonly Attribute
- The disabled Attribute
- The size Attribute
- The maxlength Attribute
- HTML5 Input Attributes
- The autocomplete Attribute
- The novalidate Attribute
- The autofocus Attribute
- The form Attribute
- The formaction Attribute
- The formenctype Attribute
- The formmethod Attribute
- The formnovalidate Attribute
- The height and width Attributes
- The list Attribute
- The min and max Attributes
- The multiple Attribute
- The pattern Attribute
- The placeholder Attribute
- The required Attribute
- The step Attribute
- HTML Graphics: Differences Between SVG and Canvas
- Drag and Drop: Make an Element Draggable
- Drag and Drop: What to Drag - ondragstart and setData()