A comprehensive reference for HTML tags, attributes, structure, and best practices — built for developers at every level.
| ATTRIBUTE | VALUE | DESCRIPTION |
|---|---|---|
| id | unique-id | Unique identifier for an element. Used by CSS selectors and JavaScript. |
| class | class-name | One or more CSS class names separated by spaces. Used for styling and scripting. |
| style | css: value; | Inline CSS styles applied directly to the element. |
| href | URL | Hypertext reference. Specifies the URL of the resource linked to. |
| src | URL | Specifies the URL of an embedded resource (image, script, video, etc.). |
| alt | text | Alternative text for images. Essential for accessibility and SEO. |
| type | text | submit | ... | Specifies the type of <input>, <button>, <script>, or <link> element. |
| name | identifier | Name of the element, used for form submission or as a target anchor. |
| value | text | number | Default value for form controls like <input>, <option>, and <button>. |
| placeholder | hint text | Short hint shown inside an input before the user enters a value. |
| disabled | (boolean) | Disables a form element so it cannot be interacted with or submitted. |
| required | (boolean) | Specifies that the input field must be filled before form submission. |
| data-* | custom value | Custom data attributes for storing extra information on HTML elements. |
| aria-* | role / value | Accessibility attributes that provide semantic meaning to assistive technologies. |
| tabindex | number | Specifies the element's tab order for keyboard navigation. |
Use tags like <header>, <nav>, <main>, <article> to provide meaning and improve accessibility for screen readers.
Every <img> tag needs an alt attribute. Use descriptive text for meaningful images; use alt="" for purely decorative ones.
Add <meta name="viewport" content="width=device-width, initial-scale=1.0"> for responsive mobile-friendly pages.
Always close your tags properly. Use self-closing syntax for void elements like <br/>, <hr/>, and <img/>.
Avoid "click here" in anchor text. Use descriptive text that explains where the link goes, improving SEO and accessibility.
Place <script> tags just before </body> or use defer/async attributes to avoid blocking page rendering.
Use only one <h1> per page for clear document hierarchy. Use <h2>–<h6> for subsections in order.
Use the W3C HTML Validator to check your markup for errors, deprecated tags, and accessibility issues.
Always associate <label> elements with form inputs using the for attribute matching the input's id.