Performance: First HTML page
This affects the initial page load speed and how quickly the browser can show content to the user.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>My Page</title> <style> body { background-color: #fff; color: #000; font-family: sans-serif; } </style> </head> <body> <h1>Welcome</h1> <p>This is my first page.</p> </body> </html>
<!DOCTYPE html> <html lang="en"> <head> <title>My Page</title> <script src="large-library.js"></script> <style> body { background: url('large-image.jpg'); } </style> </head> <body> <h1>Welcome</h1> <p>This is my first page.</p> </body> </html>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Minimal HTML with inline CSS | Low (few nodes) | 1 (initial layout) | Low (simple styles) | [OK] Good |
| HTML with blocking scripts and large images | Medium (more nodes) | Multiple (due to blocking) | High (heavy styles and images) | [X] Bad |
<!DOCTYPE html> declaration at the start of an HTML page?<!DOCTYPE html><!DOCTYPE html> specifically signals the browser to use the latest HTML standard (HTML5).<!DOCTYPE html>, then <html>, inside it <head> and <body>, and ends with </html>.<!DOCTYPE html><html><head></head><body></body></html> follows this correct order and nesting of tags.<head> inside <body><!DOCTYPE html> <html> <head> <title>My Page</title> </head> <body> <h1>Welcome</h1> <p>This is my first page.</p> </body> </html>
<h1> and <p> tags inside <body> define visible content on the page.<title> sets the browser tab name, not page body content.<!DOCTYPE html> <html> <head> <title>Test</title> </head> <body> <h1>Hello</h2> <p>Paragraph here.</p> </body> </html>
<h1> but closes with </h2>, which is a mismatch.<title>, <body>, and <p> tags are properly opened and closed.<header> for the top section, <nav> for navigation menus, <main> for main content, and <footer> for the bottom section.<header>, <nav>, <main>, <footer> lists all correct semantic tags for these parts. Other options use incorrect or non-standard tags.<top> or <bottom><head> with visible header<menu> instead of <nav>Pass the test and this pattern moves unknown