Good
<main>
<article>
<h2>News</h2>
<p>...</p>
</article>
</main>
Essential web foundations used in this project—each with quick tips and examples.
Use elements that carry meaning—<header>, <nav>, <main>, <section>, <article>, <aside>, <footer>. Improves accessibility, SEO, and maintenance.
<main>
<article>
<h2>News</h2>
<p>...</p>
</article>
</main>
<div id="main"><div class="article">...</div></div>
Exactly one <h1> per page; then descend logically (h2, h3 …). Give every <section> a heading for a clear, navigable outline.
h2 to h4).Write descriptive link text and keep a consistent menu on every page.
<nav> landmark for main menus; add aria-label only if you have multiple navs.Plan for accessible media now even if you’ll add images later:
alt="".<figure> and a visible <figcaption>.<!-- later -->
<figure>
<img src="img/example.png" alt="Short purpose-driven description">
<figcaption>Visible caption text.</figcaption>
</figure>
Native inputs + associated labels = accessible forms. Provide feedback, visible focus, and clear errors.
<label for="email">Email</label>
<input id="email" type="email" required>
aria-describedby for error/help text when needed.Arrange items in a row or column; great for navbars and toolbars.
.toolbar{ display:flex; gap:.75rem; align-items:center; }
.toolbar .spacer{ margin-left:auto; }
gap for spacing instead of margins between siblings.justify-content, align-items, flex-direction.Lay out rows and columns together. Useful for cards, galleries, and page sections.
.grid{
display:grid;
gap:1rem;
grid-template-columns:repeat(auto-fit, minmax(260px,1fr));
}
On dark backgrounds, increase base size and weight; ensure sufficient contrast and visible focus.
<img
src="img/card-800.jpg"
srcset="img/card-800.jpg 800w, img/card-1200.jpg 1200w"
sizes="(max-width: 768px) 100vw, 720px"
alt="Responsive card example" loading="lazy">
| Concept | Why It Matters | One Tip |
|---|---|---|
| Semantic HTML | Meaningful structure for users & SEO | Prefer native elements |
| Headings | Clear document outline | One H1; descend logically |
| Links | Faster navigation & comprehension | Descriptive link text |
| Forms | Accessible input collection | Every input has a label |
| Flexbox | Align/distribute items in a line | Use gap |
| Grid | Rows & columns together | minmax() + auto-fit |
| Contrast & Fonts | Readability on dark UI | Base 18px+, bold headings |
| Performance | Faster, smoother UX | Compress & lazy-load images |