Core HTML Elements

HTML Elements vs. Tags Difference Between Elements & Tags Nested & Self-Closing Tags HTML Attributes Attributes provide additional information to elements. Common Global Attributes Data Attributes Text Formatting Headings Paragraphs & Line Breaks Formatting Tags Lists in HTML Ordered & Unordered Lists Description Lists This article explains core HTML elements. Next, we’ll cover links and […]

  • Post author:
  • Post category: HTML
  • Reading time: 21 mins read
  • Post last modified: April 3, 2025

HTML Elements vs. Tags

Difference Between Elements & Tags

  • HTML Tags: Enclosed in angle brackets, e.g., <p>, <h1>.
  • HTML Elements: Include opening and closing tags along with content, e.g., <p>This is a paragraph.</p>.

Nested & Self-Closing Tags

  • Nested Elements: Elements inside another element. <div> <p>Nested Paragraph</p> </div>
  • Self-Closing Tags: Do not require a closing tag. <img src="image.jpg" alt="Example Image">

HTML Attributes

Attributes provide additional information to elements.

Common Global Attributes

  • id: Unique identifier.
  • class: Groups elements for styling.
  • style: Inline CSS styling. <p id="intro" class="text-large" style="color: blue;">Styled Text</p>

Data Attributes

  • Custom attributes starting with data-. <button data-role="admin">Click Me</button>

Text Formatting

Headings

<h1>Main Title</h1>
<h2>Subheading</h2>
HTML

Paragraphs & Line Breaks

<p>This is a paragraph.</p>
<p>New line<br>break.</p>
HTML

Formatting Tags

<strong>Bold Text</strong>
<em>Italicized Text</em>
<u>Underlined Text</u>
<mark>Highlighted Text</mark>
HTML

Lists in HTML

Ordered & Unordered Lists

<ul>
    <li>Item 1</li>
    <li>Item 2</li>
</ul>

<ol>
    <li>First</li>
    <li>Second</li>
</ol>
HTML

Description Lists

<dl>
    <dt>Term</dt>
    <dd>Definition</dd>
</dl>
HTML

This article explains core HTML elements. Next, we’ll cover links and media.

Leave a Reply