Тег <main>

Тег <main> в HTML: опис, синтаксис та приклад використання

Короткий опис:

Тег <main> призначений для основного вмісту документа і не повинен містити типових блоків, таких як шапка сайту, підвал, навігація тощо.

SEO текст:

Дізнайтеся про тег <main> в HTML: його призначення, синтаксис та приклад використання. Вивчайте основи HTML разом з нами!

Специфікація

HTML: 3.2 4.01 5.0 XHTML: 1.0 1.1

Синтаксис

<main>
  </main>

Атрибути

Для цього тега доступні лише універсальні атрибути.

Закриваючий тег

Обов'язковий.

Приклад

HTML5IECrOpSaFx

<!DOCTYPE html>
  <html>
    <head>
      <meta charset="utf-8">
      <title>main</title>
    </head> 
    <body>
      <h1>Следы невиданных зверей</h1>
      <main>
        Історія про те, як біля столової з'явилися загадкові рожеві сліди з шістьма пальцями, і чому це сталося. 
      </main>
    </body> 
  </html>

Часті запитання

  • Q: What is the purpose of the <main> tag in HTML?

    A: The <main> tag is used to define the main content of an HTML document. It should contain content that is directly related to or expands upon the central topic of the document.

  • Q: Can we have multiple <main> tags in a single HTML document?

    A: No, according to the HTML specification, an HTML document should contain only one <main> tag, which represents the main content of the document.

  • Q: Is it mandatory to use the <main> tag in every HTML document?

    A: No, the <main> tag is not mandatory in every HTML document. It is typically used to improve the document structure and accessibility by clearly defining the main content.

  • Q: Can the <main> tag be nested inside other HTML elements?

    A: Yes, the <main> tag can be nested inside most block-level elements, such as <article> or <section>, to structure the content within the main section of the document.

  • Q: Does the <main> tag have any specific styling or default behaviors associated with it?

    A: No, the <main> tag itself does not have any specific styling or default behaviors associated with it. Any styling or behavior applied to the <main> tag would need to be defined using CSS or JavaScript.