BeginnerLesson 10 of 306 min read

Beginner project: style your personal profile page

Apply everything from the beginner lessons to turn a plain profile page into a polished, card-based design.

In this lesson you will

  • Plan a mini design system
  • Write base styles and a container
  • Build header, cards, lists and a button
  • Test keyboard, small screens and contrast

About 20 minutes

From plain page to portfolio piece

In the HTML course you built a personal profile page. It worked, and it looked like a document from the nineties. Today you give it a makeover, using only what you have learned in the nine lessons so far. There is no new theory in this lesson. The goal is to practise planning a design, building it up in layers and checking your work, which is how professional front-end developers spend their days.

The goal

  • A centred page container with a comfortable width.
  • A header with a gradient background and a round profile photo.
  • Clear typography with a web font and good line height.
  • Content in cards with soft shadows.
  • Styled links and a button with hover and focus states.
  • A consistent colour palette and spacing.

Step 1: Make a plan

Before writing CSS, decide a tiny design system. It keeps you consistent and saves hundreds of small decisions.

Colours   violet #5A28C8, dark #14112E, light #F7F5FF, accent #F06CC2
Fonts     headings: Sora, body: Manrope
Spacing   8, 16, 24, 40 px
Radius    16px for cards, 999px for buttons
Width     container max 760px

Step 2: Reset and base styles

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Manrope", Arial, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.7;
  color: #14112E;
  background: #F7F5FF;
}

img { max-width: 100%; height: auto; display: block; }

h1, h2, h3 { font-family: "Sora", Arial, sans-serif; line-height: 1.2; }

The first rule fixes the width puzzle. The body sets the inherited text styles once. The image rule stops any picture from overflowing its box and removes the odd gap that appears below inline images.

Step 3: Layout the container and header

.container { width: 100%; max-width: 760px; margin: 0 auto; padding: 0 20px; }

.hero {
  background: linear-gradient(135deg, #6C2BE0, #4A6EDD);
  color: #fff;
  text-align: center;
  padding: 56px 20px 72px;
}
.hero img {
  width: 128px; height: 128px;
  border-radius: 50%;
  border: 4px solid #fff;
  margin: 0 auto 16px;
  object-fit: cover;
}
.hero h1 { margin: 0 0 8px; font-size: clamp(1.75rem, 5vw, 2.6rem); }
Good to know

The property object-fit: cover crops an image to fill its box without squashing it. It is a lifesaver for profile photos of different shapes.

Style the header: give .hero a violet-to-blue gradient, white text, centred content and 40px padding, and make the photo round using border-radius 50%.

<style>
 body { margin: 0; font-family: Arial, sans-serif; }
 .hero { /* gradient header */ }
 .hero img { /* round photo */ }
</style>
<header class="hero">
 <img src="https://picsum.photos/id/64/200/200" alt="Profile photo" width="110" height="110">
 <h1>Priya Sharma</h1>
 <p>Learner and future web developer</p>
</header>

background: linear-gradient(135deg,#6C2BE0,#4A6EDD); color:#fff; text-align:center; padding:40px 20px; and border-radius:50%.

<style>
 body { margin: 0; font-family: Arial, sans-serif; }
 .hero { background: linear-gradient(135deg,#6C2BE0,#4A6EDD); color: #fff; text-align: center; padding: 40px 20px; }
 .hero img { border-radius: 50%; border: 4px solid #fff; display: block; margin: 0 auto 12px; }
</style>
<header class="hero">
 <img src="https://picsum.photos/id/64/200/200" alt="Profile photo" width="110" height="110">
 <h1>Priya Sharma</h1>
 <p>Learner and future web developer</p>
</header>

Step 4: Cards for the content

.card {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  margin-top: 24px;
  box-shadow: 0 8px 24px rgba(20, 17, 46, .08);
}
.card h2 { margin-top: 0; font-size: 1.4rem; color: #5A28C8; }
.main { margin-top: -40px; }   /* lets the first card overlap the header */

A negative top margin on the main area pulls the first card up over the header. It is a small trick that makes the design feel layered and modern, and a good place to use a negative margin sparingly.

Step 5: Lists, links and the button

.skills { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.skills li { background: #EFEAFD; color: #3F1A9A; padding: 6px 14px; border-radius: 999px; font-weight: 700; font-size: .9rem; }

a { color: #5A28C8; }
a:hover { color: #3F1A9A; }
a:focus-visible { outline: 3px solid #46D3DC; outline-offset: 3px; }

.btn { display: inline-block; padding: .8rem 1.6rem; border-radius: 999px; background: #5A28C8; color: #fff; font-weight: 700; text-decoration: none; transition: background .2s; }
.btn:hover { background: #3F1A9A; }

The skills list uses display: flex with a gap. That is a preview of the next course section, where flexbox becomes your main layout tool. Do not worry if it is new. Copy it for now.

Step 6: Check like a professional

  1. Open the page in your browser and compare it with your plan. Does it use only your palette?
  2. Press Tab through the page and confirm every link and button has a visible focus style.
  3. Resize the window narrow, as if it were a phone. Does anything overflow?
  4. Use the developer tools to check the contrast of your smallest text.
  5. Validate the CSS at the W3C CSS validator and fix any typos.
  6. Ask a friend to open it and tell you the first thing they notice.

Style a skills list: remove the bullets and padding, make it a flex row that wraps with an 8px gap, and turn each item into a light violet pill.

<style>
 body { font-family: Arial; padding: 20px; }
 .skills { /* flex list */ }
 .skills li { /* pill */ }
</style>
<ul class="skills"><li>HTML</li><li>CSS</li><li>Design</li><li>Writing</li></ul>

list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; and each li gets a background, padding and border-radius: 999px.

<style>
 body { font-family: Arial; padding: 20px; }
 .skills { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
 .skills li { background: #EFEAFD; color: #3F1A9A; padding: 6px 14px; border-radius: 999px; font-weight: 700; }
</style>
<ul class="skills"><li>HTML</li><li>CSS</li><li>Design</li><li>Writing</li></ul>

Stretch goals

  • Add a dark mode by changing the body colours inside @media (prefers-color-scheme: dark). You will learn media queries soon.
  • Add a hover lift to the cards with transform: translateY(-4px) and a transition.
  • Style the footer with a top border and smaller grey text.
  • Publish the page for free on GitHub Pages and send the link to a friend.
Copy your reset

Keep the base styles from step 2 in a file called base.css. Start every future project by pasting them. That small habit saves time on every site you ever build.

Check what you learned

Five quick questions. Pick an answer and you will see straight away whether it is right and why.

Why define a mini design system before styling?

  1. It is required by CSS
  2. It keeps colours, fonts and spacing consistent
  3. It makes the page load faster
  4. It replaces HTML

Decisions made once keep the whole page coherent.

What does object-fit: cover do on a photo?

  1. Fills the box and crops without distorting
  2. Adds a border
  3. Hides the photo
  4. Makes it a circle

The image fills its box while keeping its proportions.

Which rule fixes the width puzzle site-wide?

  1. * { box-sizing: border-box; }
  2. * { margin: 0; }
  3. img { display: block; }
  4. body { width: 100%; }

border-box keeps padding and borders inside the width.

What must every interactive element have?

  1. A visible focus style
  2. A shadow
  3. A gradient
  4. A margin

Keyboard users rely on focus styles.

What is a good final check?

  1. Trust it works
  2. Tab through it, resize it and check contrast
  3. Only look on one screen
  4. Only validate HTML

Testing keyboard, small screens and contrast finds real problems.

Summary

  • Plan colours, fonts and spacing first.
  • Start with a base reset and container.
  • Build in layers: header, cards, details.
  • Always test keyboard, narrow screens and contrast.

Next lesson

Intermediate level begins: Flexbox, the layout tool you previewed in this project.

Questions

Can I use my own design instead?

Yes. Use the same steps with your own colours and layout. It is better to finish something you care about.

Do I need an image for the profile photo?

No. Any square picture works, or you can use a plain coloured circle with your initials.

Where do I go from here?

The intermediate lessons teach Flexbox, Grid, responsive design and positioning, which turn this single column into full page layouts.

Progress is saved in this browser.