Kazi Rahamatullah
Kazi Rahamatullah
AboutProjectsBlogContact
UsesBooks
ResumeView CV
Kazi Rahamatullah

© Copyright 2026 Kazi Rahamatullah

AboutProjectsBlogBooksUses
Twitter/XGitHubProduct HuntCodeSandbox
Back to Blog
MERNHTMLCSSTailwind CSSResponsive DesignWeb Development

MERN Course: HTML & CSS Foundations

Weeks 1–4 of the MERN syllabus — semantic HTML, CSS box model, Flexbox, Grid, responsive design, Bootstrap, Tailwind, and performance-minded styling with practical examples.

Jul 5, 20269 min read

Introduction

Every MERN developer needs a solid front-end foundation before React. This guide completes the HTML & CSS section of the MERN course syllabus with examples, Note/Tip/Warning callouts, and performance guidance — rendered the same way as the rest of this blog.

Course Reference

Quick index

#TopicDescription
1Introduction to the Web & HTMLWeb development splits into front-end (what users see) and back-end (servers, databases, APIs).
2Working with Text & ContentHeadings create a document outline.
3Tables & Forms in HTMLTables are for tabular data, not page layout.
4CSS Fundamentals & BackgroundsCSS controls presentation.
5The Box Model & LayoutEvery element is a box: content → padding → border → margin.
6Grid and Flex LayoutFlexbox excels at one-dimensional alignment (nav bars, toolbars).
7Introduction to Responsive Web DesignResponsive design adapts layout to viewport width.
8CSS Media QueriesMedia queries apply styles at breakpoints.
9Building Navigation MenusNavigation uses <nav> with a list of links.
10Introduction to CSS Frameworks (Bootstrap)Frameworks ship pre-built grids, components, and utilities so teams ship faster.
11Introduction to Tailwind CSSTailwind is utility-first: small classes compose in markup.
12CSS Variables, SASS & Other ToolsCSS custom properties (--token) enable theming (light/dark) without duplicating rules.

Week 1: HTML Foundations

1. Introduction to the Web & HTML

Web development splits into front-end (what users see) and back-end (servers, databases, APIs). HTML is the semantic skeleton — it describes structure and meaning, not appearance.

  • Use <!DOCTYPE html> so browsers render in standards mode
  • Keep one <h1> per page for accessibility and SEO
  • Prefer semantic tags over generic <div> soup

Example:

html
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>Kazi Rahamatullah — Portfolio</title>
  </head>
  <body>
    <header>
      <h1>FullStack Developer</h1>
      <p>Building MERN applications with performance in mind.</p>
    </header>
  </body>
</html>

Note

Always set lang on <html> and charset in <head>. Screen readers and search engines rely on them.

Tip

Use the browser DevTools Elements panel to inspect how semantic tags render in the accessibility tree.

Performance

Place critical meta tags early in <head>. Defer non-critical scripts with defer or load them at the end of <body>.

Back to index


2. Working with Text & Content

Headings create a document outline. Paragraphs, lists, images, and links should be chosen for meaning — not just visuals.

Example:

html
<article>
  <h2>About Me</h2>
  <p>I build scalable web apps with React, Node.js, and MongoDB.</p>
  <ul>
    <li>Frontend: React, Next.js, Tailwind CSS</li>
    <li>Backend: Express, REST APIs</li>
  </ul>
  <img src="/profile.jpg" alt="Kazi Rahamatullah profile photo" width="320" height="320" loading="lazy" />
  <a href="/contact">Get in touch</a>
</article>

Note

Never use empty alt="" on meaningful images. Decorative images can use alt="" so screen readers skip them.

Tip

Structure headings in order — never skip from h1 to h4 without intermediate levels.

Performance

Add explicit width and height on images to prevent layout shift (CLS). Use loading="lazy" for below-the-fold images.

Back to index


3. Tables & Forms in HTML

Tables are for tabular data, not page layout. Forms need labels tied to inputs for accessibility and better UX on mobile.

Example:

html
<form action="/api/contact" method="post">
  <label for="email">Email</label>
  <input id="email" name="email" type="email" required autocomplete="email" />
 
  <label for="message">Message</label>
  <textarea id="message" name="message" rows="4" required></textarea>
 
  <button type="submit">Send</button>
</form>

Note

Pair every input with a <label for="id">. Placeholder text is not a substitute for labels.

Tip

Use autocomplete attributes on forms — they improve UX and password manager compatibility.

Warning

Do not use HTML tables for page layout — it breaks accessibility and responsive behavior.

Performance

Use native input types (email, tel, number) — mobile keyboards adapt automatically.

Back to index

Week 2: Introduction to CSS Styling

4. CSS Fundamentals & Backgrounds

CSS controls presentation. External stylesheets are cached by the browser and keep HTML clean. Prefer class selectors over deep nesting.

Example:

css
/* styles.css */
.card {
  background: linear-gradient(135deg, #ffe543 0%, #4ce2e2 100%);
  background-position: center;
  background-size: cover;
  color: #111;
  font-family: system-ui, sans-serif;
}

Note

Avoid inline styles except for truly dynamic values. External CSS is easier to maintain and cache.

Tip

Co-locate related styles in one external file; split by component only when files grow large.

Performance

Compress images (WebP/AVIF) and use background-size: cover with appropriately sized assets — large hero backgrounds hurt LCP.

Back to index


5. The Box Model & Layout

Every element is a box: content → padding → border → margin. Use box-sizing: border-box globally so width math stays predictable.

Example:

css
*,
*::before,
*::after {
  box-sizing: border-box;
}
 
.layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 2rem;
  margin-inline: auto;
  padding-inline: 1.5rem;
  max-width: 72rem;
}

Note

margin collapses vertically between block elements. Use flex/grid gap when you need consistent spacing.

Tip

Use browser DevTools box-model overlay to debug unexpected spacing quickly.

Performance

Limit expensive properties during scroll (box-shadow, filter). Prefer transform for animations.

Back to index


6. Grid and Flex Layout

Flexbox excels at one-dimensional alignment (nav bars, toolbars). CSS Grid excels at two-dimensional layouts (page shells, dashboards).

Example:

css
.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
 
.dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1.5rem;
}

Note

Use Flexbox for components, Grid for page structure. Combining both is normal in production apps.

Tip

Start with Flexbox for nav bars; reach for Grid when you need both row and column control.

Performance

auto-fit + minmax() avoids media-query sprawl and reflows efficiently on resize.

Back to index

Week 3: Responsive Design & Navigation

7. Introduction to Responsive Web Design

Responsive design adapts layout to viewport width. Mobile-first means base styles target small screens; larger breakpoints add complexity.

Example:

css
.container {
  margin-inline: auto;
  width: min(100% - 2rem, 72rem);
}
 
img,
video {
  max-width: 100%;
  height: auto;
}

Note

Design content-first. If it works on a 320px screen, scaling up is easier than retrofitting mobile.

Tip

Test on real devices or Chrome device mode — emulator alone misses touch and font scaling quirks.

Performance

Serve responsive images with srcset/sizes — do not ship desktop-sized images to phones.

Back to index


8. CSS Media Queries

Media queries apply styles at breakpoints. Prefer min-width (mobile-first) over max-width (desktop-first).

Example:

css
/* Mobile base */
.sidebar {
  display: none;
}
 
@media (min-width: 768px) {
  .layout {
    grid-template-columns: 240px 1fr;
  }
  .sidebar {
    display: block;
  }
}

Note

Breakpoints should follow content, not device models. Test at 320px, 768px, and 1280px minimum.

Tip

Use clamp() for fluid typography and reduce the number of breakpoint-specific rules.

Performance

Use content-visibility: auto on long off-screen sections to skip rendering work.

Back to index


9. Building Navigation Menus

Navigation uses <nav> with a list of links. Dropdowns and mobile menus should remain keyboard-accessible.

Example:

html
<nav aria-label="Main">
  <ul class="nav-list">
    <li><a href="/" aria-current="page">Home</a></li>
    <li><a href="/blog">Blog</a></li>
    <li><a href="/contact">Contact</a></li>
  </ul>
</nav>

Note

Mark the active link with aria-current="page". Mobile menus need focus traps and Escape-to-close.

Tip

Keep dropdown menus keyboard-operable with Tab, Enter, Escape, and arrow keys.

Performance

Use CSS transform for slide-in menus — compositor-friendly and smoother on low-end devices.

Back to index


Week 4: Expanding Your CSS Toolkit

10. Introduction to CSS Frameworks (Bootstrap)

Frameworks ship pre-built grids, components, and utilities so teams ship faster. Bootstrap uses component classes; learn its grid before overriding everything.

Example:

html
<div class="container py-4">
  <div class="row g-4">
    <div class="col-md-6 col-12">
      <div class="card p-3">Feature A</div>
    </div>
    <div class="col-md-6 col-12">
      <div class="card p-3">Feature B</div>
    </div>
  </div>
</div>

Note

Import only the Bootstrap modules you need. Full bundles add unused CSS unless you purge/tree-shake.

Tip

Learn the framework grid before overriding — fighting defaults wastes time.

Warning

Shipping the full Bootstrap bundle without purging can add 200KB+ of unused CSS.

Performance

Use PurgeCSS or Bootstrap's Sass imports to keep CSS under ~50KB gzipped in production.

Back to index


11. Introduction to Tailwind CSS

Tailwind is utility-first: small classes compose in markup. It pairs well with React/Next.js and design systems like this portfolio site.

Example:

html
<article class="mx-auto max-w-3xl border-4 border-black p-6 shadow-[4px_4px_0_#000]">
  <h2 class="text-2xl font-extrabold uppercase">Blog Post</h2>
  <p class="mt-4 leading-relaxed text-neutral-700">Utility classes keep styles colocated with components.</p>
</article>

Note

Extract repeated utility chains into components or @apply in CSS when a pattern repeats 3+ times.

Tip

Install the Tailwind IntelliSense extension for autocomplete in VS Code.

Performance

Tailwind v4 JIT generates only used utilities — production CSS stays small without manual purging.

Back to index


12. CSS Variables, SASS & Other Tools

CSS custom properties (--token) enable theming (light/dark) without duplicating rules. SASS adds nesting and mixins — compile to plain CSS in build step.

Example:

css
:root {
  --color-accent: #ff6b8b;
  --space-md: 1rem;
}
 
.card {
  border-color: var(--color-accent);
  padding: var(--space-md);
}
 
.dark {
  --color-accent: #b283ff;
}

Note

CSS variables cascade and can change at runtime — perfect for theme toggles. SASS variables do not.

Tip

Mirror this site's light/dark tokens with CSS variables in :root and .dark.

Performance

Define design tokens once. Runtime theme switches via CSS variables avoid reloading stylesheets.

Back to index


Share this article

XLinkedInFacebook
Kazi Rahamatullah

Written by

Kazi Rahamatullah

FullStack Developer

X / TwitterGitHubLinkedIn

Subscribe to my newsletter

Stay up to date and get notified when I share new contents.

No spam ever, unsubscribe anytime