Falytom logoFALYTOM
Games
ToolsUI ComponentsServicesProductsAbout
LoginSign Up
menu
  1. Home
  2. /Web Development
  3. /Html
  4. /Main Article
Your Progress0%
0 of 76 completed

Topics

Getting Started

  • What is HTML?
  • How the Web Works
  • Setting Up Your Environment
  • Your First HTML Page

HTML Document Structure

  • The DOCTYPE Declaration
  • The HTML Element
  • The Head Section
  • Meta Tags
  • The Body Element
  • HTML Comments

Text and Formatting

  • Headings (h1-h6)
  • Paragraphs
  • Line Breaks and Horizontal Rules
  • Text Formatting (Bold, Italic, etc.)
  • Quotations and Citations
  • Preformatted Text and Code
  • Subscript and Superscript

Links and Navigation

  • Creating Links
  • Absolute vs Relative URLs
  • Link Targets and Attributes
  • Email and Phone Links
  • Internal Page Links

Images and Media

  • Adding Images
  • Image Attributes
  • Image Formats
  • Figure and Figcaption
  • Responsive Images
  • Audio Elements
  • Video Elements
  • Embedding Content

Lists

  • Unordered Lists
  • Ordered Lists
  • Description Lists
  • Nested Lists

Tables

  • Table Basics
  • Table Headers and Footers
  • Spanning Columns and Rows
  • Table Captions
  • Styling Tables

Forms - Part 1 (Basics)

  • Introduction to Forms
  • Text Input Fields
  • Labels and Placeholders
  • Textarea Element
  • Checkboxes
  • Radio Buttons

Forms - Part 2 (Advanced)

  • Select Dropdowns
  • File Upload Inputs
  • HTML5 Input Types
  • Form Validation
  • Form Buttons
  • Fieldsets and Legends
  • Form Accessibility

Semantic HTML

  • What is Semantic HTML?
  • Header and Footer
  • Nav Element
  • Main and Article
  • Section and Aside
  • Div vs Semantic Elements
  • Time and Mark Elements

HTML5 Features

  • HTML5 Overview
  • Canvas Element
  • SVG in HTML
  • Geolocation API
  • Drag and Drop
  • Local Storage
  • Web Workers

Web Accessibility

  • Introduction to Accessibility
  • ARIA Attributes
  • Keyboard Navigation
  • Alt Text Best Practices
  • Color Contrast and Typography
  • Testing for Accessibility

Best Practices & SEO

  • HTML Best Practices
  • SEO Fundamentals
  • Meta Tags for SEO
  • Structured Data

Main and Article

Main content and article elements

The <main> element represents the primary content of the page, while <article> represents self-contained, reusable content. These elements help structure your content semantically and improve accessibility.

The Main Element

The <main> element contains the dominant content of your page—the content that's unique to that page. Every page should have only one <main> element.

Basic Main Usage

basic-main.html
<!DOCTYPE html>
<html lang="en">
<body>
  <header>
    <h1>My Website</h1>
    <nav>
      <a href="/">Home</a>
      <a href="/about">About</a>
    </nav>
  </header>
  
  <!-- Main content of the page -->
  <main>
    <h2>Welcome to Our Site</h2>
    <p>This is the primary content of the page.</p>
  </main>
  
  <footer>
    <p>&copy; 2024 My Website</p>
  </footer>
</body>
</html>

Important Rules for Main

  • Only one <main> per page
  • Don't put <main> inside <article>, <aside>, <header>, <footer>, or <nav>
  • Main should contain content unique to the page
  • Don't include site-wide elements like navigation or logos
main-dont.html
<!-- Wrong: Navigation in main -->
<main>
  <nav>Site navigation</nav>
  <p>Content</p>
</main>

<!-- Wrong: Multiple main elements -->
<main>First section</main>
<main>Second section</main>

<!-- Correct: One main with sections -->
<header>
  <nav>Site navigation</nav>
</header>

<main>
  <section>
    <h2>First Section</h2>
    <p>Content...</p>
  </section>
  <section>
    <h2>Second Section</h2>
    <p>Content...</p>
  </section>
</main>

The Article Element

The <article> element represents self-contained content that could be independently distributed or reused. Think blog posts, news articles, forum posts, or product cards.

When to Use Article

Use article when the content:

  • Makes sense on its own
  • Could be syndicated (RSS feed, aggregator)
  • Could be shared independently
  • Has its own heading

Blog Post Example

blog-article.html
<main>
  <article>
    <h2>Introduction to JavaScript</h2>
    <p>By John Doe on January 15, 2024</p>
    
    <p>JavaScript is a programming language...</p>
    
    <section>
      <h3>Getting Started</h3>
      <p>To begin with JavaScript...</p>
    </section>
    
    <section>
      <h3>Basic Syntax</h3>
      <p>JavaScript syntax is similar to...</p>
    </section>
  </article>
</main>

Multiple Articles

You can have multiple articles on a page (like a blog listing):

multiple-articles.html
<main>
  <h1>Recent Blog Posts</h1>
  
  <article>
    <h2>First Blog Post</h2>
    <p>Published on January 15, 2024</p>
    <p>Post content goes here...</p>
    <a href="/post/1">Read more</a>
  </article>
  
  <article>
    <h2>Second Blog Post</h2>
    <p>Published on January 14, 2024</p>
    <p>Post content goes here...</p>
    <a href="/post/2">Read more</a>
  </article>
  
  <article>
    <h2>Third Blog Post</h2>
    <p>Published on January 13, 2024</p>
    <p>Post content goes here...</p>
    <a href="/post/3">Read more</a>
  </article>
</main>

Main vs Article

Understanding the difference:

main-vs-article.html
<!-- Main = Primary content area of entire page -->
<main>
  <h1>Blog Post Title</h1>
  <p>This is the main content...</p>
</main>

<!-- Article = Self-contained content -->
<main>
  <article>
    <h2>Blog Post 1</h2>
    <p>Content...</p>
  </article>
  
  <article>
    <h2>Blog Post 2</h2>
    <p>Content...</p>
  </article>
</main>

<!-- You can have article inside main -->
<main>
  <h1>Latest News</h1>
  
  <article>
    <h2>News Story</h2>
    <p>Story content...</p>
  </article>
</main>

Nested Articles

Articles can contain other articles (like comments on a blog post):

nested-articles.html
<main>
  <article>
    <h2>Main Blog Post</h2>
    <p>Post content here...</p>
    
    <section>
      <h3>Comments</h3>
      
      <article>
        <h4>Comment by Jane</h4>
        <p>Great article!</p>
      </article>
      
      <article>
        <h4>Comment by Bob</h4>
        <p>Thanks for sharing!</p>
      </article>
    </section>
  </article>
</main>

Practical Examples

News Website

news-site.html
<body>
  <header>
    <h1>News Daily</h1>
    <nav>
      <a href="/">Home</a>
      <a href="/world">World</a>
      <a href="/tech">Tech</a>
    </nav>
  </header>
  
  <main>
    <h2>Today's Top Stories</h2>
    
    <article>
      <h3>Breaking: New Technology Released</h3>
      <p>Published: January 15, 2024</p>
      <img src="tech.jpg" alt="New technology">
      <p>A revolutionary new technology...</p>
    </article>
    
    <article>
      <h3>Market Update: Stocks Rise</h3>
      <p>Published: January 15, 2024</p>
      <p>Stock markets showed gains...</p>
    </article>
  </main>
  
  <aside>
    <h3>Trending Topics</h3>
    <ul>
      <li>Technology</li>
      <li>Finance</li>
    </ul>
  </aside>
  
  <footer>
    <p>&copy; 2024 News Daily</p>
  </footer>
</body>

E-commerce Product Listing

product-listing.html
<main>
  <h1>Featured Products</h1>
  
  <article>
    <h2>Wireless Headphones</h2>
    <img src="headphones.jpg" alt="Wireless headphones">
    <p>Price: $99.99</p>
    <p>High-quality wireless headphones with noise cancellation.</p>
    <button>Add to Cart</button>
  </article>
  
  <article>
    <h2>Smart Watch</h2>
    <img src="watch.jpg" alt="Smart watch">
    <p>Price: $299.99</p>
    <p>Track your fitness and stay connected.</p>
    <button>Add to Cart</button>
  </article>
</main>

Best Practices

Use Proper Headings

proper-headings.html
<!-- Good: Clear heading hierarchy -->
<main>
  <h1>Page Title</h1>
  
  <article>
    <h2>Article Title</h2>
    
    <section>
      <h3>Section Title</h3>
      <p>Content...</p>
    </section>
  </article>
</main>

Test Independence

Ask: "Could this article stand alone?" If yes, use <article>:

independence-test.html
<!-- Good: Independent content -->
<article>
  <h2>Complete Recipe: Chocolate Cake</h2>
  <p>Ingredients: flour, sugar, cocoa...</p>
  <p>Instructions: Mix ingredients...</p>
</article>

<!-- Better as section: Depends on context -->
<section>
  <h2>Ingredients</h2>
  <p>Flour, sugar, cocoa...</p>
</section>

Accessibility Benefits

  • Screen readers announce <main> as a landmark
  • Users can skip directly to main content
  • <article> provides structure for content navigation
  • Better semantic meaning helps all assistive technologies

Key Takeaways

  • Use <main> for the primary page content
  • Only one <main> per page
  • Use <article> for self-contained content
  • Articles should make sense independently
  • You can have multiple articles on a page
  • Articles can be nested (e.g., comments)
  • Articles can exist inside main
  • Both elements improve accessibility and SEO

What's Next?

Now that you understand main and article elements, the next lesson will cover <section> and <aside> elements for additional content organization.

Know someone who'd find this guide helpful? Please share!

Previous
Nav Element
Next
Section and Aside

Never Miss a New HTML Tutorial

Join 1,000+ developers learning HTML step-by-step. Get new tutorials, tips, and exclusive resources delivered to your inbox - completely FREE.

You might also like

UI Components

Ready-made components for your projects

Developer Tools

Boost productivity with handy generators

HTML Game

Learn HTML concepts through interactive gameplay

Join Our Web Development Training Program

Master frontend & backend development with hands-on projects.

Menu

Topics

Getting Started

  • What is HTML?
  • How the Web Works
  • Setting Up Your Environment
  • Your First HTML Page

HTML Document Structure

  • The DOCTYPE Declaration
  • The HTML Element
  • The Head Section
  • Meta Tags
  • The Body Element
  • HTML Comments

Text and Formatting

  • Headings (h1-h6)
  • Paragraphs
  • Line Breaks and Horizontal Rules
  • Text Formatting (Bold, Italic, etc.)
  • Quotations and Citations
  • Preformatted Text and Code
  • Subscript and Superscript

Links and Navigation

  • Creating Links
  • Absolute vs Relative URLs
  • Link Targets and Attributes
  • Email and Phone Links
  • Internal Page Links

Images and Media

  • Adding Images
  • Image Attributes
  • Image Formats
  • Figure and Figcaption
  • Responsive Images
  • Audio Elements
  • Video Elements
  • Embedding Content

Lists

  • Unordered Lists
  • Ordered Lists
  • Description Lists
  • Nested Lists

Tables

  • Table Basics
  • Table Headers and Footers
  • Spanning Columns and Rows
  • Table Captions
  • Styling Tables

Forms - Part 1 (Basics)

  • Introduction to Forms
  • Text Input Fields
  • Labels and Placeholders
  • Textarea Element
  • Checkboxes
  • Radio Buttons

Forms - Part 2 (Advanced)

  • Select Dropdowns
  • File Upload Inputs
  • HTML5 Input Types
  • Form Validation
  • Form Buttons
  • Fieldsets and Legends
  • Form Accessibility

Semantic HTML

  • What is Semantic HTML?
  • Header and Footer
  • Nav Element
  • Main and Article
  • Section and Aside
  • Div vs Semantic Elements
  • Time and Mark Elements

HTML5 Features

  • HTML5 Overview
  • Canvas Element
  • SVG in HTML
  • Geolocation API
  • Drag and Drop
  • Local Storage
  • Web Workers

Web Accessibility

  • Introduction to Accessibility
  • ARIA Attributes
  • Keyboard Navigation
  • Alt Text Best Practices
  • Color Contrast and Typography
  • Testing for Accessibility

Best Practices & SEO

  • HTML Best Practices
  • SEO Fundamentals
  • Meta Tags for SEO
  • Structured Data
Falytom logoFALYTOM

Learn technologies like HTML, CSS, JavaScript, React, NodeJS and more through interactive games, tutorials, components and free tools. Transform your businesses with AI chatbots, SEO-optimized websites, and professional development services.

© 2025 Tomilola Group
  • Facebook logo
  • Twitter logo
  • Instagram logo
  • LinkedIn logo
  • GitHub logo
  • YouTube logo