HTML Best Practices & SEO
Write production-quality HTML — semantic markup, SEO optimization, structured data, and HTML best practices for modern web development.
Semantic HTML & SEO
- Structured Data (Schema.org): JSON-LD markup in <script type='application/ld+json'> — tells Google about your content (articles, products, FAQs, reviews). Rich search results
- Open Graph Tags: <meta property='og:title'> — control how your page appears when shared on social media. Title, description, image for Facebook, Twitter, LinkedIn
- Heading Hierarchy: Single <h1> per page, followed by <h2>-<h6> in order — screen readers and search engines use heading structure to understand content organization
- Semantic Elements: <article> for self-contained content, <section> for grouped content, <aside> for tangential content, <figure>/<figcaption> for illustrations with captions
- Meta Tags: <meta name='description' content='...'> for search snippets. <meta name='viewport'> for mobile. <link rel='canonical'> to prevent duplicate content
- Performance Hints: <link rel='preconnect'> early-connect to CDNs. <link rel='preload'> for critical resources. <link rel='prefetch'> for next-page resources. async/defer for scripts
Try It Yourself: Web Storage Demo
Line 39: Malformed tag: "< localStorage.length; i++) { const k = localStorage.key(i); items.push(k + ' = ' + localStorage.getItem(k)); } show(items.length ? '📦 Stored data: ' + items.join(' ') : '(empty)'); } function clearData() { localStorage.clear(); show('🗑️ All data cleared'); } function show(t) { document.getElementById('output').textContent = t; } </script>"
💡 Tags must use valid HTML names and be properly formed. Example: <div>, <p class="text">
Line 50: Wrong closing tag: </body> found, expected </script> (line 50)
💡 Close <script> (opened on line 29) with </script> before closing </body>.
Line 51: Wrong closing tag: </html> found, expected </script> (line 51)
💡 Close <script> (opened on line 29) with </script> before closing </html>.
Line 2: Unclosed <html> (opened on line 2)
💡 Add </html> to properly close this element.
Line 16: Unclosed <body> (opened on line 16)
💡 Add </body> to properly close this element.
Line 29: Unclosed <script> (opened on line 29)
💡 Add </script> to properly close this element.