DEV Community

Cover image for HTML tags | main
Carlos Espada
Carlos Espada

Posted on • Edited on

2

HTML tags | main

It is used to indicate the main content of a document. There can only be one per document (unless it has the hidden attribute) and it cannot descend from an <article>, <aside>, <footer>, <header> or <nav>.

Its content must be unique, it must not include elements that are repeated in other documents such as sidebars, links to navigate, copyright information, site logos, search forms ...

It does not contribute to the outline of the document, so it is purely informative.

It has an implicit ARIA role main, although to maintain compatibility with older browsers the redundant formula of <main role="main"> can be used.

  • Type: block
  • Self-closing: No
  • Semantic value: Yes

Definition and example | Support

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Explore a sea of insights with this enlightening post, highly esteemed within the nurturing DEV Community. Coders of all stripes are invited to participate and contribute to our shared knowledge.

Expressing gratitude with a simple "thank you" can make a big impact. Leave your thanks in the comments!

On DEV, exchanging ideas smooths our way and strengthens our community bonds. Found this useful? A quick note of thanks to the author can mean a lot.

Okay