HTML Elements
James
Herring
- <!DOCTYPE html>
- Declares the document as HTML5.
- <html>
- Root element that wraps the entire webpage.
- <head>
- Contains metadata, links, scripts, and the page title.
- <title>
- Sets the text shown in the browser tab.
- <body>
- Contains all visible content on the page.
- <h1>
- Primary page heading; used for the main title.
- <h2>
- Section heading.
- <h3>
- Subsection heading.
- <p>
- Paragraph of text.
- <span>
- Inline container for styling or grouping small text segments.
- <a>
- Creates a hyperlink to another page, section, or resource.
- <img>
- Displays an image; requires src and alt attributes.
- <div>
- Generic block-level container used for layout and grouping.
- <header>
- Top section of a page or article (logo, navigation, intro).
- <footer>
- Bottom section (copyright, legal info, links).
- <nav>
- Contains navigation menus or link groups.
- <main>
- Represents the primary content of the page.
- <section>
- Groups related content into thematic sections.
- <article>
- Self-contained content such as blog posts or cards.
- <ul>
- Unordered list (bulleted).
- <ol>
- Ordered list (numbered).
- <li>
- List item inside <ul> or <ol>.
- <table>
- Defines a table.
- <tr>
- Table row.
- <td>
- Table data cell.
- <th>
- Table header cell (bold and centered by default).
- <form>
- Wraps form fields and handles submission.
- <input>
- Single-line input field (text, email, checkbox, etc.).
- <button>
- Clickable button for actions or form submission.
- <label>
- Describes an input field and improves accessibility.