Hands-on exercise · HTML & CSS

Build your first profile card.

Copy the two files below, open them in your browser, and see your own webpage come to life.

Get started

  1. Create a project folder.
    Open it in your code editor.
  2. Create index.html.
    Copy the HTML code below and paste it into the file.
  3. Create style.css.
    Copy the CSS code and save it in the same folder.
  4. Open index.html in your browser.
    You should see a profile card like the preview.
Expected resultLive preview

Source code

Copy or download each file.
HTMLindex.html
<!DOCTYPE html>
<html>
<head>
    <title>Personal Profile Card</title>
    <link rel="stylesheet" href="style.css">
</head>
<body>

    <div class="card">

        <img src="https://plus.unsplash.com/premium_photo-1690407617542-2f210cf20d7e?fm=jpg&q=60&w=3000&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=NHwxMjA3fDA%3D" alt="Profile photo">

        <h1>Alex Thomas</h1>

        <h3>Aspiring Web Developer</h3>

        <p>Hi! I'm a student who loves technology,
           coding and creating websites.</p>

        <div class="skills">
            <span>HTML</span>
            <span>CSS</span>
        </div>

        <a href="mailto:alex@example.com">Contact Me</a>

    </div>

</body>
</html>
CSSstyle.css
body {
    background: #eef2ff;
    margin: 0;
    font-family: Arial, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.card {
    background: white;
    width: 280px;
    padding: 25px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 4px 15px #00000010;
}

img {
    width: 90px;
    height: 90px;
    object-fit: cover;
    border-radius: 50%;
}

h1 {
    color: #172033;
}

h3 {
    color: #2563eb;
}

p {
    color: #64748b;
}

.skills {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 20px 0;
}

span {
    background: #e0e7ff;
    color: #3730a3;
    padding: 8px 12px;
    border-radius: 6px;
}

a {
    display: block;
    background: #2563eb;
    color: white;
    font-weight: bold;
    padding: 12px;
    border-radius: 8px;
    text-decoration: none;
}