This document is an HTML cheat sheet that outlines the basic structure of an HTML document and lists common HTML tags along with their functions. It also details HTML attributes and event attributes used in JavaScript for interactivity. The cheat sheet serves as a quick reference for web developers and learners to understand HTML syntax and usage.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
2 views3 pages
HTML Cheat Sheet
This document is an HTML cheat sheet that outlines the basic structure of an HTML document and lists common HTML tags along with their functions. It also details HTML attributes and event attributes used in JavaScript for interactivity. The cheat sheet serves as a quick reference for web developers and learners to understand HTML syntax and usage.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3
HTML Cheat Sheet
Basic HTML Structure
<!DOCTYPE html> <html> <head> <title>Page Title</title> </head> <body> <h1>Welcome to HTML</h1> <p>This is a paragraph.</p> </body> </html>
Common & Basic HTML Tags
<h1> to <h6> Headings from largest to smallest
<p> Paragraph <a href='URL'> Hyperlink <img src='image.jpg' alt='desc'> Image <ul> / <ol> Unordered & Ordered Lists <li> List Item <table> Table <tr> / <td> / <th> Table Rows, Data, Headers <form> Form for user input <input> Input fields (text, radio, checkbox) <button> Clickable button <br> Line Break <hr> Horizontal Line <strong> Bold Text <em> Italic Text <mark> Highlighted Text <small> Smaller Text <sup> Superscript (e.g., x^2) <sub> Subscript (e.g., H2O) <pre> Preformatted Text <code> Displays Code <blockquote> Blockquote for Quoted Text <abbr> Abbreviation with Tooltip <div> Defines a section or container <span> Inline container for styling <nav> Defines a navigation section <header> Defines a header section <footer> Defines a footer section <section> Defines a section of content <article> Defines an independent article <aside> Defines content aside from the main content <main> Specifies the main content of a document <figure> Groups media content with captions <figcaption> Caption for a <figure> element <label> Labels for form elements <textarea> Multi-line text input field <select> Dropdown list <option> Options inside a dropdown list <fieldset> Groups related form elements <legend> Caption for a <fieldset> <iframe> Embeds another webpage <meta> Provides metadata about the document <link> Links external resources like CSS <script> Embeds JavaScript <style> Embeds CSS styles <audio> Embeds audio content <video> Embeds video content <source> Specifies media resources for <video> or <audio>
HTML Attributes
href Defines the URL for a hyperlink
src Specifies the source file for images/media alt Alternative text for images title Tooltip text on hover id Unique identifier for an element class Class name for CSS styling style Inline CSS styling width/height Defines width & height for elements target Specifies how links open (_blank, _self) rel Defines relationship between documents type Specifies type of input or script disabled Disables an input field or button readonly Makes input field read-only required Makes input field mandatory placeholder Hint text in input fields value Defines initial value of input field checked Preselects checkbox or radio button maxlength Sets character limit for input min/max Defines range for number inputs step Specifies interval for number inputs autofocus Auto-focuses on an input field
Event Attributes (Used in JavaScript)
onclick Triggers a function when clicked
onmouseover Runs script when hovered onchange Runs script when value changes onfocus Runs script when focused