Pular para o conteúdo
Skillpedia
Sites e telas (frontend)75 mil · #2819

doctype

O que ela faz

Esta skill verifica se uma página web começa com a linha correta de doctype do HTML5. Ela é para desenvolvedores que querem uma exibição consistente entre navegadores.

Quando usar

  • ✓Quando uma página parece diferente em cada navegador.
  • ✓Quando você cria uma nova página ou template.
  • ✓Quando a saída de um framework pode estar sem a declaração.

Link da skill

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/doctype/SKILL.md

Copie e cole na sua IA (Claude, ChatGPT ou Cursor) pedindo para seguir as instruções.

Como usar

O jeito mais fácil: copie a mensagem e cole na sua IA. Ela lê a skill e segue as instruções.

Mensagem pronta para colar

Use esta skill para me ajudar: https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/doctype/SKILL.md Leia o arquivo SKILL.md desse link e siga as instruções dele na minha tarefa.
Quer que a sua IA encontre skills como esta sozinha?Instale o MCP grátis do Skillpedia: uma linha, e ela pesquisa entre 15.000+ skills antes de cada tarefa.Instalar em 1 minuto →

Exemplo do que pedir para a IA

“Você pode verificar se minha página tem o doctype HTML5 correto?”

5 skills novas por semana. 1 minuto de leitura.

Como funciona

O agente verifica a primeira linha do HTML bruto da página. Se a declaração estiver ausente, antiga ou não for a primeira, ele sugere a linha correta.

Conteúdo técnico (SKILL.md original)

Texto original do autor, em inglês, direto do GitHub.

Use the HTML5 doctype

Without the HTML5 doctype, browsers fall back to Quirks Mode, which emulates the rendering behavior of pre-standards browsers from the late 1990s. In Quirks Mode, the CSS box model changes (padding adds to element width), vertical centering breaks, and many modern HTML5 APIs may behave unexpectedly. This causes cross-browser rendering inconsistencies that are difficult to debug and may produce inaccessible layouts.

Quick Reference

  • Every HTML document must begin with <!DOCTYPE html> as its very first line
  • Without a doctype, browsers enter Quirks Mode — a legacy compatibility mode with inconsistent CSS and JavaScript behavior
  • The HTML5 doctype is case-insensitive but <!DOCTYPE html> (uppercase DOCTYPE) is the conventional form
  • No other content, not even whitespace or BOM characters, should appear before the doctype
  • Frameworks like Next.js, Nuxt, and Remix automatically include the doctype — verify in rendered HTML, not source templates

Check

Check the very first line of the HTML document source (not the DOM — the raw HTTP response). The document must begin with <!DOCTYPE html> (case-insensitive). Flag if: (1) the doctype is missing entirely; (2) an old HTML4 or XHTML doctype is used (contains PUBLIC and a DTD URL); (3) the doctype is not the absolute first content (whitespace or BOM before it triggers some browsers to enter Quirks Mode); (4) the doctype has incorrect syntax.

Fix

Add <!DOCTYPE html> as the absolute first line of the HTML document, before the <html> tag. Remove any old HTML4 or XHTML doctypes. Ensure no whitespace, comments, or BOM markers precede the doctype. For framework projects: verify in the root HTML template file, and confirm in the rendered HTML by viewing page source in the browser.

Explain

The DOCTYPE declaration tells the browser which version of HTML the document uses. <!DOCTYPE html> activates Standards Mode (also called Full Standards Mode) in all modern browsers, ensuring consistent rendering behavior. Without it, browsers enter Quirks Mode to emulate old IE behavior — a compatibility mode that changes the box model, float clearing, table rendering, and other CSS behaviors. The HTML5 doctype was intentionally made simple (just <!DOCTYPE html>) to replace the verbose HTML4/XHTML doctypes that required a full DTD URL.

Code Review

Review templates, server-rendered HTML, and shared components that output markup related to Use the HTML5 doctype. Flag exact elements, attributes, and routes where the rendered HTML violates the rule.


For full implementation details, code examples, and framework-specific guidance, see references/rule.md.

Rule page: https://frontendchecklist.io/rules/html/doctype

Perguntas frequentes

O que acontece sem o doctype?

Os navegadores entram no quirks mode, um modo antigo de compatibilidade em que layouts e scripts podem se comportar de forma imprevisível.

Onde a verificação deve ser feita?

A skill diz para verificar o HTML bruto que o navegador recebe, como o template raiz de um framework.

Algo pode vir antes dela?

Não. A skill diz que nada deve vir antes da declaração, nem mesmo espaços em branco.

Detalhes

Descrição original do autor

Use when applies to all HTML documents. Always check the very first line of the raw HTML source (view-source: or DevTools > Network > Response). In SSR frameworks, check the root HTML template (e.g., _document.tsx in Next.js, index.html in Vite/Vue, application.html.erb in Rails). The doctype is not a tag — it is a declaration and does not need a closing tag.

repo: thedaviddias/Front-End-Checklist

Popularidade

Estrelas no GitHub
75 mil
Posição no ranking
#2819
Licença
MIT
Atualizada em
31/10/2026

Essa skill é útil?

0

Entre para votar.

Comentários

  • …

Mais skills deste repositório

Skills parecidas