Featured
- Get link
- X
- Other Apps
Day 10: HTML Best Practices & Mini Project
📘 Day 10: HTML Best Practices & Mini Project
This lesson collects HTML best practices you should adopt in real projects — accessibility, SEO basics, performance friendly markup, progressive enhancement and a mini project (portfolio/landing page) to practice everything.
1. Clean, semantic structure (use the right tags)
Prefer semantic elements (<header>, <main>, <article>, <section>, <footer>) over generic <div> when the element has meaning. Semantic markup helps screen readers and search engines.
2. Accessibility essentials
- Always provide
altfor meaningful images. If an image is decorative, usealt="". - Use
<label for="id">for form inputs and group related inputs with<fieldset>/<legend>. - Provide skip links (
<a class="skip" href="#main">Skip to main content</a>) for keyboard users. - Use correct landmark roles:
role="navigation",role="main",role="contentinfo"when necessary. - Ensure focus outlines are visible (do not remove :focus outlines without an accessible replacement).
3. SEO & metadata
Include descriptive <title>, unique meta description, and basic Open Graph tags for sharing:
<head> <meta charset="utf-8"> <title>Jane Doe — Frontend Portfolio</title> <meta name="description" content="Portfolio of Jane Doe — frontend developer. Projects, contact, blog."> <meta property="og:title" content="Jane Doe — Portfolio"> </head>
4. Performance-friendly markup
- Avoid heavy inline styles; use external CSS files for caching.
- Optimize images (WebP/AVIF, multiple sizes) and set
width/heightto prevent layout shift. - Lazy-load below-the-fold images:
<img loading="lazy">. - Minimize DOM depth and avoid unnecessary wrappers.
5. Progressive enhancement & graceful degradation
Start with a working HTML page (functional without JS) and enhance with JS/CSS — ensures users without JS still get content.
6. Headings & document outline
Use a logical heading order (one <h1> per page), then <h2>, <h3> etc. Don’t skip levels arbitrarily.
Mini Project — Build a Simple Portfolio / Landing Page
Requirements:
- Use semantic structure: header, nav, main, section, article, footer.
- Include a hero with heading, short intro, call-to-action (link or button).
- Show a projects section with at least 2 project cards (image + caption).
- Include a contact form (name, email, message) with labels.
- Ensure images have alt text and the page has a proper title and meta description.
Starter template — Try & edit below
Edit the code and click Run Code. This is a minimal skeleton you can expand.
Checklist before publishing
- Unique & informative
<title>and meta description - Alt text for images and readable link text
- Proper heading order and ARIA where necessary
- Images optimized and
loading="lazy"where appropriate - Forms properly labeled and accessible
Popular Posts
📘 Day 36: Understanding the DOM (Document Object Model)
- Get link
- X
- Other Apps
Day 27: Bootstrap Mini Project – Responsive Portfolio Page
- Get link
- X
- Other Apps
Comments
Post a Comment