🏗️ Basic Document Structure
Fundamentals for creating any HTML page, including document declaration, essential metadata, and base body elements.
DOCTYPE Declaration
Declares the document type and HTML version the browser should use to render the page. Essential to ensure the standard HTML5 rendering mode and avoid "quirks" mode, which can cause visual inconsistencies.
When to use: When starting any HTML document to define the HTML version.
HTML Root Element
The root element of the entire HTML page. The `lang` attribute defines the primary language of the document's content (in this case, Brazilian Portuguese), which is crucial for accessibility (screen readers) and search engines (SEO).
When to use: Always as the first element inside the DOCTYPE.
Document Metadata (Head)
Contains metadata about the document, such as title, links to stylesheets, scripts, SEO information, and other settings that are not directly displayed on the page but are important for the browser and search engines.
When to use: To include all non-visible information of the page.
Visible Content (Body)
Contains all visible content of the web page, including text, images, links, videos, and other interactive elements. Everything the user sees and interacts with is within this tag.
When to use: To wrap all content that will be displayed in the browser.
Character Encoding
Defines the document's character encoding as UTF-8, which supports most characters in all languages, including accents and special characters. Ensures that text is displayed correctly across different operating systems and browsers.
When to use: Always at the beginning of the <head> to prevent encoding issues.
Viewport Configuration
Configures the viewport for mobile devices, controlling the width of the visible area (`width=device-width`) and the initial zoom level (`initial-scale=1.0`). Essential to ensure the page design is responsive and adapts to different screen sizes.
<meta name="viewport" content="width=device-width, initial-scale=1.0">
When to use: On all pages to ensure responsiveness on mobile devices.
Headings, Paragraphs and Breaks
Essential elements for structuring text, defining heading hierarchy, and controlling content flow.
Títulos de Seção (H1-H6)
Define títulos de diferentes níveis de importância. `<h1>` é o título mais importante (geralmente o título principal da página), e `<h6>` é o menos importante. Usados para estruturar o conteúdo semanticamente e são relevantes para SEO.
When to use: Para definir a hierarquia e estrutura de cabeçalhos em seu conteúdo.
Text Paragraph
Represents a paragraph of text. It is the fundamental element for blocks of text in an HTML document, separating content into readable units.
When to use: For any block of text that forms a paragraph.
Line Break
Inserts a simple line break, moving subsequent content to the next line without creating a new paragraph. Used for line breaks within the same block of text (e.g., in an address).
When to use: When a line break is needed, but a new paragraph is not semantically appropriate.
Horizontal Line (Thematic Break)
Represents a thematic break between paragraphs of content, indicating a change of subject or section. Usually rendered as a horizontal line by the browser, but its purpose is semantic.
When to use: To indicate a change of topic or section within the content.
Text Formatting and Emphasis
Tags for applying formatting and giving semantic meaning to specific parts of text.
Important Text (Strong)
Indicates that the contained text is of great importance, relevance, or urgency. Usually rendered in bold by browsers. It has a stronger semantic meaning than just `<b>`.
When to use: To highlight critical or high-priority content.
Emphasized Text
Indicates that the contained text should be emphasized, usually to give a different meaning or to express a tone. Generally rendered in italics by browsers. It has a stronger semantic meaning than just `<i>`.
When to use: To emphasize a word or phrase that changes the meaning of the sentence.
Highlighted Text (Mark)
Highlights or emphasizes a piece of text, as if marked with a yellow highlighter. Used to draw attention to specific parts of the content that are relevant to the user's current context.
When to use: To highlight relevant text in a specific context, such as search results.
Smaller Text (Small)
Represents secondary comments, copyrights, footer text, and other information considered 'small' in relation to the main text. Usually rendered with a smaller font.
When to use: For copyright information, legal notices, or footer text.
Deleted Text (Deleted)
Represents text that has been deleted from a document or is no longer relevant. Usually rendered with a line through the text (strikethrough), indicating it has been removed.
When to use: To show changes in a document, such as old prices.
Inserted Text (Inserted)
Represents text that has been inserted into a document. Usually rendered with an underline, indicating it has been added. Used in conjunction with `<del>` to show revisions.
When to use: To show text that has been added to a revised document.
Links and Images
Elements for creating hyperlinks and embedding images in web pages, essential for navigation and visual content.
Basic Link (Anchor)
Creates a hyperlink to another page, resource, or part of the same document. The `href` (Hypertext REFerence) attribute specifies the destination URL the link points to.
When to use: To create navigation links or external references.
Link in New Tab
Creates a hyperlink that, when clicked, opens the specified resource in a new browser tab or window. The `target="_blank"` attribute is used for this behavior.
<a href="url" target="_blank">
When to use: To open external links without taking the user away from the current page.
Embed Image
Embeds an image in the document. The `src` (SouRCe) attribute specifies the path to the image file, and `alt` (ALTernative text) provides an alternative textual description, essential for accessibility (screen readers) and SEO.
<img src="caminho" alt="descrição">
When to use: To display images on your page.
Responsive Images (Picture)
A container that allows specifying multiple image sources (`<source>`) for different conditions (such as screen sizes, pixel densities, or image formats), and an `<img>` element as a fallback. Helps optimize image loading and adapt them to various devices.
When to use: To serve images optimized for different viewports or formats.
🎯 Semantic Structure Elements
Elements that provide structural meaning to content, improving accessibility, SEO, and code maintenance.
Page/Section Header
Represents the introductory content of a section or the entire document, usually containing titles, logos, navigation, and/or a search field. Not to be confused with `<h1>-<h6>` headings.
When to use: To group introductory elements, such as the top of a page or section.
Main Navigation
Represents a section of navigation links, such as menus, indexes, or tables of contents. Intended for the main site navigation or an important section.
When to use: To wrap blocks of primary navigation links.
Main Content
Represents the dominant content of the document's `<body>`. There should be only one `<main>` element per document, and its content should be unique to that page, excluding sidebars, navigation, etc.
When to use: To delimit the main and unique content of your page.
Generic Section
Represents a generic section of thematically grouped content. It usually contains a heading (h1-h6) and can be used to divide the main content into logical and coherent parts.
When to use: To group related content that forms a logical section.
Independent Content (Article)
Represents independent and self-contained content, such as a blog post, a newspaper article, a user comment, or an interactive widget. Can be distributed and reused independently of the rest of the page.
When to use: For content that can be read independently, such as a blog article.
Secondary Content (Aside)
Represents content that is tangentially related to the main content of the document, but can be considered separate. Often used for sidebars, pull quotes, or ad blocks.
When to use: For sidebars, pull quotes, or related information.
Rodapé da Página/Seção
Representa o rodapé de uma seção ou de todo o documento. Geralmente contém informações sobre o autor, direitos autorais, links relacionados, informações de contato ou navegação secundária.
When to use: Para agrupar informações de rodapé, como direitos autorais e links de contato.
Semantic Text Elements
Tags that add structural and contextual meaning to specific text blocks.
Long Quote (Blockquote)
Indicates that the contained text is a long quote from another source. Usually rendered with an indent by the browser. The `cite` attribute can be used to point to the source of the quote.
When to use: To quote blocks of text from other sources.
Work Title (Cite)
Used to cite the title of a creative work (book, film, music, painting, etc.) or the name of the source of a quotation. The content is usually rendered in italics.
When to use: To reference the title of a cited work.
Computer Code
Displays a small fragment of computer code. The content is usually rendered in a monospace font, indicating it is code. Can be used within `<pre>` for larger blocks of code.
When to use: To display inline code snippets or within a paragraph.
Preformatted Text
Displays preformatted text. Text within this tag is displayed in a monospace font and preserves whitespace and line breaks exactly as written in the source code. Useful for displaying code or ASCII art.
When to use: To display blocks of code or text that require exact formatting.
Abbreviation
Represents an abbreviation or an acronym. The `title` attribute can be used to provide the full expansion of the abbreviation, improving accessibility and user understanding.
When to use: To mark abbreviations and provide their full meaning.
Contact Information
Provides contact information for the author/owner of the document or the nearest section. May include name, physical address, email, phone, URL, etc.
When to use: To display contact information semantically.
Media and Embedded Content
Elements for embedding figures, captions, and other external content types into the page.
Figure Container
Used to group self-contained content, such as images, diagrams, photos, code blocks, etc., along with its caption (`<figcaption>`), making it independent of the main document flow and referencable.
When to use: To group an image, code, or other content with its caption.
Figure Caption
Provides a caption or description for the content of a `<figure>` element. It should be the first or last child of a `<figure>`.
When to use: To add a descriptive caption to a <figure> element.
External Content (Iframe)
Embeds another HTML document within the current document. Used to display content from other sources, such as YouTube videos, Google Maps, or content from other websites, in an isolated manner.
When to use: To embed content from other sources or HTML documents.
Embedded Content (Embed)
Embeds external content from a specified insertion point in the document. Used to integrate third-party plugins or non-HTML content, such as PDFs, audio/video files, or Flash animations (though its use has declined).
When to use: To embed content from external plugins or non-HTML media.
Multimedia Object (Object)
Embeds an external object (such as a plugin, PDF, Flash, or even another HTML document) into the HTML document. Offers more fallback and content control options than `<embed>`, but is less common nowadays.
When to use: To embed external objects with more control over fallbacks.
📋 List Types
Elements for organizing information in ordered, unordered, or definition lists.
Unordered List
Creates an unordered list of items. List items are usually marked with bullets (dots, squares, etc.), indicating that the order is not semantically important.
When to use: For lists where the order of items is not relevant (e.g., shopping list).
Ordered List
Creates an ordered list of items. List items are usually marked with numbers or letters, indicating a sequence or hierarchy.
When to use: For lists where the order of items is important (e.g., recipe steps).
List Item
Represents an individual item within a list (`<ul>` or `<ol>`). Must be a direct child of `<ul>`, `<ol>`, or `<menu>`.
When to use: For each item within an ordered or unordered list.
Definition List
Creates a definition list, which is a list of terms and their respective descriptions. Useful for glossaries, Q&A, or metadata.
When to use: To create glossaries or lists of terms and their definitions.
Definition Term
Represents a term to be defined within a definition list (`<dl>`). Each `<dt>` is usually followed by one or more `<dd>` elements.
When to use: To define the term in a definition list.
Definition Description
Represents the description or definition of a term (`<dt>`) within a definition list (`<dl>`).
When to use: To provide the description or explanation of a term in a definition list.
List Attributes
Attributes for customizing the appearance and behavior of ordered and unordered lists.
Standard Numbered List
Defines an ordered list that uses Arabic numerals (1, 2, 3...) as markers. This is the default type and can be omitted.
When to use: For ordered lists with standard numbering.
Uppercase Letter List
Defines an ordered list that uses uppercase letters (A, B, C...) as markers for the list items.
When to use: For ordered lists that use uppercase letters as markers.
Lowercase Letter List
Defines an ordered list that uses lowercase letters (a, b, c...) as markers for the list items.
When to use: For ordered lists that use lowercase letters as markers.
Roman Numeral List
Defines an ordered list that uses uppercase Roman numerals (I, II, III...) as markers for the list items.
When to use: For ordered lists that use Roman numerals as markers.
Ordered List Start
Starts the count of an ordered list from a specific number (in this case, 5), instead of starting from 1. The value can be any integer.
When to use: To continue a list from a specific point or when the logical order requires a different start.
Unordered List (No Markers)
Removes the default markers from an unordered list, allowing full customization via CSS. This is an example of inline styling, but external CSS is preferred.
<ul style="list-style-type: none;">
When to use: When you want to remove default markers and style the list with CSS.
Table Structure
Fundamental elements for creating and organizing data in tabular format.
Table Container
The main container for tabular data. Defines an HTML table, grouping all its elements (header, body, footer, rows, and cells).
When to use: To create any data table.
Table Header
Groups the header content of a table. Contains the column header information, usually using `<th>` elements.
When to use: To define the semantic header of a table.
Table Body
Groups the body content of a table. Contains the main data rows of the table, using `<tr>` and `<td>` elements.
When to use: To define the main data body of a table.
Table Footer
Groups the footer content of a table. Typically contains summaries, totals, or additional information related to the table body data.
When to use: To define the semantic footer of a table, such as totals or notes.
Table Row
Defines a row of cells in a table (Table Row). Each `<tr>` must contain one or more `<th>` (header cells) or `<td>` (data cells) elements.
When to use: For each new row of data or header in the table.
Header Cell
Defines a header cell in a table (Table Header). Content is usually centered and bold by default, and semantically represents a header for a column or row, improving accessibility.
When to use: For cells that serve as column or row headers.
Data Cell
Defines a standard data cell in a table (Table Data). It contains the actual table data. It is the most basic element for displaying content within a row.
When to use: For each common data cell in a table.
Table Attributes
Attributes for controlling the presentation and layout of cells in HTML tables.
Table Border (Deprecated)
Adds a 1-pixel border around the table and its cells. This attribute is deprecated in HTML5; border styling should be applied exclusively via CSS for better separation of concerns.
When to use: Avoid using. Prefer CSS for border styling.
Merge Columns (Colspan)
Makes a data cell span (merge) two or more adjacent columns in the table. The attribute value indicates the number of columns to be merged.
When to use: To merge cells horizontally, spanning multiple columns.
Merge Rows (Rowspan)
Causes a data cell to occupy (merge) three or more adjacent rows in the table. The attribute value indicates the number of rows to be merged.
When to use: To merge cells vertically, spanning multiple rows.
Header Scope (Column)
Indicates that the header cell (`<th>`) provides a header for all cells in the same column. Essential for accessibility, as screen readers can associate data with their respective headers.
When to use: To indicate that a <th> is the header for an entire column.
Header Scope (Row)
Indicates that the header cell (`<th>`) provides a header for all cells in the same row. Essential for accessibility, especially in complex tables.
When to use: To indicate that a <th> is the header for an entire row.
🚀 Modern HTML5 Fields
New HTML5 input types for collecting specific data with enhanced validation and user interfaces.
Date Picker
Creates an input field for selecting a date (day, month, year). Browsers usually provide a native calendar selector (date picker) to facilitate selection.
When to use: To collect a specific date from the user.
Time Selector
Creates an input field for selecting a time (hours and minutes). Browsers may offer an optimized time control.
When to use: To collect a specific time from the user.
Local Date and Time Selector
Creates an input field for selecting a local date and time, without timezone information. Combines the functionalities of `type="date"` and `type="time"`.
<input type="datetime-local">
When to use: To collect a combined local date and time.
Month Selector
Creates an input field for selecting a month and year. Useful for credit card expiration dates or time periods.
When to use: To collect only the month and year.
Week Selector
Creates an input field for selecting a week and year. The display format may vary between browsers.
When to use: To collect a specific week of the year.
Color Picker
Creates an input field for selecting a color. Browsers usually provide a native color picker, returning the value in hexadecimal format (e.g., `#RRGGBB`).
When to use: To allow the user to choose a color.
Slider Control (Range)
Creates a slider control for selecting a value within a specified range. The `min`, `max`, and `step` attributes define the control's behavior and limits.
When to use: To allow selection of a numeric value within a range, such as volume or zoom.
File Upload
Creates an input field that allows the user to select one or more files from their device for upload to the server. The `multiple` attribute allows the selection of multiple files.
When to use: To allow the user to upload files.
🎬 Audio and Video
HTML5 elements for embedding and controlling multimedia content directly in web pages.
Audio Player
Embeds audio content in the document. The `controls` attribute adds the browser's default playback controls (play/pause, volume, progress bar, etc.), allowing user interaction.
When to use: To embed audio files on your page.
Video Player
Embeds video content in the document. The `controls` attribute adds the browser's default playback controls (play/pause, volume, progress bar, fullscreen, etc.), allowing user interaction.
When to use: To embed video files on your page.
Media Source
Specifies multiple media sources for `<audio>` or `<video>` elements. The browser chooses the first source it can play, based on the `type` attribute (e.g., `video/mp4`, `audio/mpeg`), ensuring cross-browser compatibility.
<source src="file.mp4" type="video/mp4">
When to use: To provide different audio/video formats for broad compatibility.
Captions/Descriptions Track
Allows adding timed text tracks (such as subtitles, closed captions, descriptions, chapters) to `<video>` or `<audio>` elements. The `kind` attribute defines the track type (e.g., `subtitles`, `captions`, `descriptions`).
<track kind="subtitles" src="subtitles.vtt">
When to use: To add subtitles, descriptions, or other timed metadata to media.
Autoplay Video
A video configured to start playback automatically (`autoplay`), loop indefinitely (`loop`), and with audio muted (`muted`) upon page load. Common for background videos or banners, as browsers generally block `autoplay` with sound.
<video autoplay loop muted>
When to use: For background videos or those that should be soundless and loop automatically.
Video Poster Image
Defines an image to be displayed in the video player before the video starts playing, while the video is downloading, or if the video cannot be loaded. Serves as a thumbnail or cover.
<video poster="poster.jpg">
When to use: To display a preview image for the video.
Graphics and Canvas
Elements for creating dynamic and vector graphics directly in the browser.
Canvas Element
Provides a rectangular drawing area on the HTML page, where graphics can be rendered dynamically using JavaScript (Canvas API). Ideal for games, data visualization, complex animations, and image editing.
When to use: For dynamic graphic drawing via JavaScript.
Scalable Vector Graphic (SVG)
Defines scalable vector graphics (Scalable Vector Graphics). SVG images are XML-based, can be scaled to any size without loss of quality, and are manipulable via CSS and JavaScript, making them ideal for icons and illustrations.
When to use: For vector graphics that need to be scalable and manipulable.
Canvas with Dimensions
Creates a canvas element with specific width and height dimensions in pixels. These dimensions define the coordinate space for drawing and are important for correct content rendering.
<canvas width="300" height="150">
When to use: When defining the initial dimensions for the canvas drawing area.
SVG with ViewBox
Defines the dimensions and position of an SVG's viewport. The four values represent `min-x`, `min-y`, `width`, and `height` of the user coordinate system, allowing the SVG to be scaled to fit its container.
<svg viewBox="0 0 100 100">
When to use: To control the coordinate system and scaling of an SVG.
Additional Graphic Elements
Elements for creating interactivity in images and ensuring correct SVG rendering.
Image Map
Defines a client-side image map, which allows creating clickable areas (hotspots) on an image. Used in conjunction with the `<area>` element and referenced by the `usemap` attribute of an `<img>`.
When to use: To create clickable areas on an image.
Clickable Area in Map
Defines a clickable area (hotspot) within an image map (`<map>`). The `shape` (e.g., `rect`, `circle`, `poly`) and `coords` attributes define the shape and position of the area, and `href` the link destination.
When to use: To define interactive regions within an image map.
Canvas with ID for JavaScript
A canvas element with a unique identifier (`id`), allowing it to be easily accessed and manipulated by JavaScript scripts using `document.getElementById()`.
When to use: To interact with the canvas using JavaScript.
SVG with Namespace
Declares the XML namespace for the SVG element, indicating that the content within the `<svg>` tag should be interpreted as scalable vector graphics. Although often implicit in HTML5, it is good practice for compatibility.
<svg xmlns="http://www.w3.org/2000/svg">
When to use: When embedding SVG directly into HTML, especially to ensure compatibility with XML parsers.
♿ ARIA Accessibility Attributes
WAI-ARIA attributes for improving HTML element accessibility, providing semantic information for assistive technologies.
Accessible Label (aria-label)
Provides an accessible text label for an element when no visible label is available (e.g., an icon button). Used by assistive technologies (screen readers) to describe the element.
When to use: To provide a textual label for elements without visible text, such as icon buttons.
Description by ID (aria-describedby)
Associates an element with another that provides a more detailed description. The value is the `id` of the element containing the description, allowing screen readers to read the associated description.
When to use: To associate an element with a longer, more detailed description in another element.
Expanded/Collapsed State (aria-expanded)
Indicates the state of an expandable element (such as a dropdown menu, accordion, or button that reveals content), informing whether it is expanded (`true`) or collapsed (`false`).
When to use: To indicate whether a component (menu, accordion) is open or closed.
Hide from Assistive Technologies (aria-hidden)
Removes an element and all its descendants from the accessibility tree, making it invisible to assistive technologies (screen readers). Used for purely decorative or hidden content that should not be announced.
When to use: To hide purely decorative elements from screen readers.
Dynamic Update Region (aria-live)
Defines a "live" region that should be announced by assistive technologies when its content changes dynamically. `polite` means changes are announced when the user is idle, while `assertive` announces immediately.
When to use: To announce dynamic content updates (e.g., error messages, search results).
Semantic ARIA Roles
Role attributes for defining the function or purpose of an element, especially when non-semantic elements are used.
Navigation Role
Defines that the element acts as a navigation region, containing links to navigate within the document or to related documents. Used when a non-semantic element (like `div`) is used for navigation.
When to use: To indicate that an element is a navigation area (if it's not <nav>).
Main Content Role
Defines that the element contains the main content of the document. Used when a non-semantic element (like `div`) is used for the main content, as a fallback for older browsers that do not support `<main>`.
When to use: To indicate the main content of the page (if not <main>).
Complementary Content Role
Defines that the element contains supporting content that complements the main content but is separate from it. Similar to `<aside>`, used when a `div` is employed.
When to use: To indicate complementary content (if not <aside>).
Search Role
Defines that the element is a region containing a search mechanism for the document or site. Helps assistive technologies quickly identify search functionality.
When to use: To identify the search area on your page.
Alert Role
Defines that the element is an important alert message that is dynamically added and should be announced immediately by assistive technologies. Used for critical notifications that require immediate attention.
When to use: For important alert messages that require immediate attention.
Keyboard Navigation and Focus
Attributes for controlling tab order and element focus, essential for keyboard navigation users.
Focusable Element (tabindex="0")
Makes an element focusable via keyboard and includes it in the default tab order of the document, following the DOM order. Allows elements that are not normally focusable (like `div` or `span`) to receive focus.
When to use: To make non-interactive elements keyboard-focusable in the natural order.
Programmatically Focusable (tabindex="-1")
Makes an element programmatically focusable (via JavaScript using `.focus()`), but removes it from the default keyboard tab order. Useful for dynamically focusing elements without interfering with linear navigation.
When to use: To focus elements via JavaScript without including them in the tab order.
Shortcut Key (Accesskey)
Defines a shortcut key for an element, allowing the user to activate the element by pressing a key combination (varies by browser and operating system, e.g., Alt+Shift+S in Chrome).
When to use: To provide keyboard shortcuts for important elements (use sparingly).
Autofocus
A boolean attribute that causes a form element to be automatically focused when the page loads. Only one element can have `autofocus` per page. It can be problematic for accessibility if not used carefully.
When to use: To automatically focus a crucial form field upon page load.
Alternative Content for Accessibility
Techniques for providing textual and contextual alternatives for non-text content, ensuring all users can access the information.
Alternative Text for Images
Provides an alternative textual description for an image. Essential for screen reader users and when the image cannot be loaded, conveying the image's meaning.
<img src="..." alt="Descrição detalhada">
When to use: Always for images that convey important information.
Decorative Image
Indicates that the image is purely decorative and does not convey important information. The empty `alt=""` and `role="presentation"` instruct screen readers to ignore it, avoiding unnecessary noise.
<img src="..." alt="" role="presentation">
When to use: For images that do not add informative value, such as purely visual icons.
Long Description (longdesc - Obsolete)
An obsolete attribute for `<img>` that pointed to an HTML document containing a long description of the image. It has been replaced by `aria-describedby` or by descriptions in the text adjacent to the image.
<longdesc="descricao.html">
When to use: Avoid using, as it is obsolete.
Figure with Accessible Caption
Associates a `<figure>` element with a caption (`<figcaption>`) using its `id`, improving accessibility for screen readers that might not automatically associate them. The `aria-labelledby` points to the `id` of the `<figcaption>` or another label element.
<figure aria-labelledby="caption1">
When to use: To explicitly associate a figure with its caption for screen readers.