Який тег вказує браузеру, що це HTML-документ

Which tag tells the browser it’s an HTML document

Which tag tells the browser that this is an HTML document? The answer is the <!DOCTYPE html> declaration, which appears at the very top of the file and tells the browser to interpret the page as an HTML5 document.

What <!DOCTYPE html> does

<!DOCTYPE html> is not a regular HTML tag for displaying content. It is a document declaration that helps the browser choose the correct rendering mode for the page.

If it is missing, some browsers may switch to quirks mode, which can make the layout behave differently from what you expect. That is why the doctype declaration is always placed first in an HTML file.

Why it matters for a page

The doctype tag matters because it affects how the browser reads CSS, calculates element sizes, and handles older or nonstandard rules.

  • reduces the risk of unpredictable layout behavior;
  • enables standards mode rendering;
  • makes the page more compatible with modern browsers;
  • helps avoid development errors.

What the correct start of an HTML file looks like

The correct HTML document starts with the doctype declaration, followed by the html, head, and body elements.

A typical structure looks like this: <!DOCTYPE html>, then the <html> tag opens, metadata goes inside <head>, and the visible page content is placed in <body>.

Minimal example

A minimal HTML document is very simple: <!DOCTYPE html> on the first line, followed by the basic page structure without extra elements.

  • <!DOCTYPE html>
  • <html lang=”en”>
  • <head>
  • <meta charset=”UTF-8″>
  • <title>Page title</title>
  • </head>
  • <body>
  • </body>
  • </html>

Common beginner mistakes

Common beginner mistakes happen when people confuse doctype with a tag that displays content or place it somewhere other than the beginning of the file.

Another issue is using older declaration formats from previous HTML versions, even though modern pages only need <!DOCTYPE html>. A further mistake is assuming the declaration creates the document structure by itself. In reality, it only tells the browser how to read the file.

Short conclusion

Which tag tells the browser that this is an HTML document? The correct answer is <!DOCTYPE html>, and it should be the first line in every modern HTML file.