Skip to content

Courses / CSS3 Mastery: Beginner to Advanced / Project 1: Responsive Profile and Landing Page

2,087 people viewed this

Project 1: Responsive Profile and Landing Page

Section 36: Project 1 — Responsive Profile and Landing Page

In this project, build a responsive personal profile landing page using semantic HTML and modern CSS. The page includes a navigation bar, hero section, skill cards, and contact link.

Concepts used

  • CSS custom properties for colors, spacing, and reusable values.
  • Flexbox for the navigation and hero layout.
  • Grid for skill cards.
  • clamp() for fluid typography.
  • Media queries for responsive behavior.
  • Focus-visible styling for keyboard users.

Complete runnable project

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Developer Profile</title>
<style>
:root {
  --primary: #2563eb;
  --text: #172033;
  --muted: #64748b;
  --surface: #ffffff;
  --page: #f1f5f9;
  --radius: 1rem;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, sans-serif; color: var(--text); background: var(--page); line-height: 1.6; }
a { color: var(--primary); }
a:focus-visible { outline: 3px solid #f59e0b; outline-offset: 4px; }
.container { width: min(1100px, calc(100% - 2rem)); margin-inline: auto; }
.site-header { padding-block: 1rem; background: var(--surface); }
.nav { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.nav__links { display: flex; gap: 1rem; flex-wrap: wrap; }
.nav__links a { text-decoration: none; }
.hero { display: grid; grid-template-columns: 1.4fr 1fr; gap: 2rem; align-items: center; padding-block: clamp(3rem, 8vw, 6rem); }
.hero h1 { font-size: clamp(2rem, 5vw, 4rem); line-height: 1.1; margin-block: 0 1rem; }
.hero p { color: var(--muted); max-width: 55ch; }
.button { display: inline-block; background: var(--primary); color: white; text-decoration: none; padding: .75rem 1rem; border-radius: .5rem; }
.button:hover { background: #1d4ed8; }
.button:focus-visible { outline: 3px solid #f59e0b; outline-offset: 3px; }
.profile-panel, .skill-card { background: var(--surface); padding: 1.5rem; border-radius: var(--radius); }
.skills { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; padding-bottom: 3rem; }
.skill-card h3 { margin-top: 0; }
@media (max-width: 700px) {
  .hero { grid-template-columns: 1fr; }
  .skills { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 450px) {
  .skills { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}
</style>
</head>
<body>
<header class="site-header">
  <nav class="nav container" aria-label="Main navigation">
    <a href="#home"><strong>MyPortfolio</strong></a>
    <div class="nav__links">
      <a href="#skills">Skills</a>
      <a href="#contact">Contact</a>
    </div>
  </nav>
</header>
<main id="home" class="container">
  <section class="hero">
    <div>
      <p>Hello, I'm a web developer</p>
      <h1>I build useful digital experiences.</h1>
      <p>I enjoy creating accessible, responsive websites with clean and maintainable code.</p>
      <a class="button" href="#contact">Contact me</a>
    </div>
    <aside class="profile-panel">
      <h2>About me</h2>
      <p>Focused on frontend development, reusable components, and performance.</p>
    </aside>
  </section>
  <section id="skills" aria-labelledby="skills-title">
    <h2 id="skills-title">My skills</h2>
    <div class="skills">
      <article class="skill-card"><h3>HTML</h3><p>Semantic page structure.</p></article>
      <article class="skill-card"><h3>CSS</h3><p>Responsive layouts and styling.</p></article>
      <article class="skill-card"><h3>JavaScript</h3><p>Interactive experiences.</p></article>
    </div>
  </section>
  <section id="contact" class="profile-panel">
    <h2>Let's connect</h2>
    <p>Replace this example with your real contact information.</p>
    <a href="mailto:hello@example.com">hello@example.com</a>
  </section>
</main>
</body>
</html>

How it works

  • clamp(): sets a minimum, fluid preferred value, and maximum font size.
  • minmax(0, 1fr): creates flexible grid tracks that can shrink to prevent some overflow problems.
  • Media queries: change the layout at viewport widths where the current layout no longer fits comfortably.
  • Semantic HTML: header, nav, main, section, and article convey structure.

Practice exercise

Customize the colors, add a projects section, and make the navigation and cards look good at 375px, 768px, and 1280px viewport widths. Replace placeholder contact information before publishing.

Knowledge check: 10 MCQs

  1. Which layout is used for the skill cards? Answer: CSS Grid. Explanation: grid-template-columns defines the card columns.
  2. Which layout property is used for the navigation? Answer: Flexbox. Explanation: display:flex arranges the navigation items.
  3. What does clamp() provide? Answer: A minimum, preferred, and maximum value. Explanation: It supports fluid sizing within limits.
  4. Why use semantic elements? Answer: To express meaningful document structure. Explanation: They improve maintainability and accessibility.
  5. What does minmax(0, 1fr) mean in this grid? Answer: A track that can shrink to zero and otherwise share flexible space. Explanation: The zero minimum helps prevent intrinsic content sizes from forcing the track wider.
  6. What is a media query used for? Answer: Applying styles conditionally. Explanation: It can adapt layout to viewport conditions.
  7. Why use :focus-visible? Answer: To provide a visible keyboard focus indicator. Explanation: Keyboard users need to know which control is focused.
  8. What does box-sizing: border-box do? Answer: Includes padding and border in declared width and height. Explanation: It simplifies box-size calculations.
  9. What is the purpose of the viewport meta tag? Answer: To help mobile browsers use the intended viewport width and scale. Explanation: It supports responsive layout behavior.
  10. Should the page be tested at only one width? Answer: No. Explanation: Responsive behavior must be checked at multiple sizes.

Rate this course

No ratings yet — yours can be the first.

Stars show on this course. Your written note stays private.

Your stars