AI Computer Institute
Expert-curated CS & AI curriculum aligned to CBSE standards. A bharath.ai initiative. About Us

Building a Professional Portfolio Website

📚 Web Development⏱️ 24 min read🎓 Grade 8
✍️ AI Computer Institute Editorial Team Updated: August 2026 CBSE-aligned · Peer-reviewed · 24 min read
Content curated by subject matter experts with IIT/NIT backgrounds. All chapters are fact-checked against official CBSE/NCERT syllabi.

Two students, two ways of being noticed

Rohan and Aditi are both in Class 8 and both want a seat in their school's coding club, which only takes ten students a year based on what applicants show, not what they claim. Rohan writes a page in his notebook: "I have made a calculator program and a quiz game. I am good at HTML and Python." Aditi sends the selection committee a link. When the teacher clicks it, a page opens with her name at the top, a short introduction, and three working projects she actually built — click one, and a multiplication quiz runs right there in the browser; click another, and a converter turns kilometres into miles as you type. Both students are telling the truth about their skills. Only one of them is showing proof that anyone can verify in ten seconds without installing anything or taking her word for it.

That difference — a claim versus a working, clickable demonstration — is the entire reason portfolio websites exist, in Class 8 coding clubs and in real hiring decisions years later. This chapter teaches you how to build one properly: not by copying a template, but by understanding what each file, tag, and property is actually doing, so that you could explain your own site line by line if someone asked.

What exactly is a "portfolio website"?

A portfolio website is a small set of connected web pages, hosted at a public address, whose only job is to display evidence of what you can do — your projects, your skills, and a way to contact you. It is different from a resume in one crucial way: a resume is a static description read by a human, while a portfolio is an interactive artifact that a visitor can operate. If your resume says "I can build websites," the proof is unconvincing until the resume itself is a website. This is why, from this chapter onward, your portfolio is not just an assignment — it is the first item in your portfolio.

Every portfolio website, no matter how advanced, is built from the same three ingredients, and understanding the division of labour between them is the single most important idea in this chapter.

The three jobs every website divides among itself

Think of a website the way you'd think of a person getting ready to appear on stage. There is a skeleton that gives the body its structure and holds everything in the right place. There are clothes and makeup that determine how the person looks — colour, spacing, style. And there is behaviour — how the person reacts when someone claps, waves, or asks a question. A website separates these exact three concerns into three languages:

  • HTML (HyperText Markup Language) is the skeleton. It states what exists on the page — a heading, a paragraph, a link, a list — and how these pieces are nested inside one another. HTML never decides colours or fonts.
  • CSS (Cascading Style Sheets) is the clothing and makeup. It decides how the skeleton looks — colours, spacing, size, layout on the screen. CSS never decides what content exists.
  • JavaScript (JS) is the behaviour. It makes the page react — validating a contact form, running a quiz, toggling a menu. A basic portfolio can work with zero JavaScript; a resume-like page with working demos usually needs a little.

A very common beginner mistake is to write everything as one giant HTML file, with colours crammed into every tag using inline style="..." attributes and quiz logic scattered as inline onclick attributes. This works for a five-line page, but it does not scale: change one colour, and you must hunt through a hundred tags to fix it everywhere. Professional practice keeps the three files separate — index.html, style.css, script.js — precisely so that a single change in one file (say, changing your theme colour) updates the whole site at once. We will build our portfolio this separated way from the very first line.

Planning before typing: what goes on the page

Before opening a code editor, a professional decides the page's information architecture — the list of sections a visitor needs, in the order they need them. For a student portfolio, four sections cover almost every case:

  1. Introduction — your name and one line about who you are.
  2. About — a short paragraph: your interests, grade, and what you're learning.
  3. Projects — the actual evidence: short descriptions (and, later, links) to things you built.
  4. Contact — a way to reach you, such as an email address.

Notice what is deliberately absent: no music that autoplays, no flashing banners, no ten navigation items for a four-section site. A portfolio's job is to let a stranger understand who you are and what you've built in under thirty seconds. Every extra element you add is something that could distract from that goal, so the planning stage is really a filtering stage — deciding what to leave out is as important as deciding what to include.

Giving each part of the page a real name: semantic HTML

Once you know your sections, you write them in HTML. A beginner who has only learned the <div> tag will wrap every section in a <div>, because a <div> can technically hold anything. This is the second common misconception worth naming directly: using <div> for every container is not wrong syntax, but it throws away free information. HTML5 gives you tags that describe the role of a container, not just its shape:

  • <header> — the introductory block at the top of the page (name, tagline, navigation).
  • <nav> — a block of navigation links.
  • <main> — the one primary content area of the page (used exactly once per page).
  • <section> — a thematic grouping of content, usually with its own heading.
  • <article> — a self-contained piece of content that would still make sense if you copy-pasted it elsewhere, like one project card.
  • <footer> — the closing block (copyright, secondary links).

These tags render with no visual difference from a <div> by default — the browser still just stacks them top to bottom. So why do they matter? Two concrete reasons. First, a visually impaired visitor using a screen reader can jump straight to "navigation" or "main content" by name, because the screen reader announces these landmarks — a page built entirely from <div>s gives it nothing to announce. Second, six months from now when you reopen your own file to fix a bug, <section id="projects"> tells you instantly what that block is for, while <div class="wrapper2"> tells you nothing. Semantic tags are a gift to your future self and to every visitor who isn't looking at the screen the same way you are.

Here is a complete, minimal portfolio page built with this structure:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Aditi Sharma - Portfolio</title>
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <header>
    <h1>Aditi Sharma</h1>
    <nav>
      <a href="#about">About</a>
      <a href="#projects">Projects</a>
      <a href="#contact">Contact</a>
    </nav>
  </header>

  <main>
    <section id="about">
      <h2>About Me</h2>
      <p>I am a Class 8 student who enjoys building small web projects and solving puzzles.</p>
    </section>

    <section id="projects">
      <h2>My Projects</h2>
      <article class="card">
        <h3>Unit Converter</h3>
        <p>A tool that converts kilometres to miles using JavaScript.</p>
      </article>
      <article class="card">
        <h3>Times Table Quiz</h3>
        <p>An HTML quiz that checks multiplication answers.</p>
      </article>
    </section>

    <section id="contact">
      <h2>Contact</h2>
      <p>Email: aditi.sharma@example.com</p>
    </section>
  </main>

  <footer>
    <p>&copy; 2026 Aditi Sharma</p>
  </footer>
</body>
</html>

Tracing this file the way the browser does

Reading HTML is a skill, and you build it by tracing execution the same way you'd trace a Python program. The browser reads this file top to bottom as a single stream of characters, but it doesn't display a flat stream — it builds a tree of nested boxes, called the DOM (Document Object Model), and then paints that tree on screen. Follow the nesting: <html> is the root; it directly contains <head> (metadata, invisible on the page) and <body> (everything visible). Inside <body> sit three top-level children in order: <header>, <main>, and <footer> — and that order is exactly the top-to-bottom order they will appear on screen, because with no special layout rules, a browser stacks block-level elements vertically in source order. Inside <main> are three <section> children, each holding its own <h2> heading and content — the "projects" section additionally nests two <article class="card"> children. Every tag you open with <tagname> must close with </tagname> in reverse order of opening — this is why </section> appears before </main>, not after. The image below shows this exact file as a tree of nested boxes, which is the mental model you should build for every page you write from now on.

Nested box diagram of the semantic HTML page structure <body> header nav: About | Projects | Contact main section#about (h2 + p) section#projects (h2) article.card Unit Converter article.card Times Table Quiz section#contact (h2 + p) footer Source order top to bottom = screen order top to bottom (block-level default stacking)

Styling with intention: the CSS box model

Structure is in place; now comes appearance. Every single HTML element, when the browser paints it, occupies a rectangular box, and CSS controls that box using exactly four measurable layers, always in the same order from the inside out:

  1. content — the actual text or image, sized by width and height.
  2. padding — transparent space between the content and the border; it is "inside" the element and shares its background colour.
  3. border — a visible line drawn around the padding.
  4. margin — transparent space outside the border, used to push other elements away; it never shares the element's background.

This is exactly where a very persistent misconception lives: students often use "padding" and "margin" interchangeably, assuming both just mean "some empty space." They are not interchangeable, and mixing them up produces bugs you cannot explain. Padding is empty space that still belongs to the element (its background colour shows through the padding). Margin is empty space that belongs to nobody — it is the gap between one element's border and its neighbour's border, and it never gets coloured. If you want visible breathing room inside a coloured card, you increase padding. If you want space between two separate cards, you increase margin. Confusing the two is why beginners sometimes make a box bigger by adding margin, then wonder why the background colour didn't stretch to fill the new space — it doesn't, because margin is outside the coloured area entirely.

Let's make this concrete with actual numbers, matching a card style for our project section:

.card {
  width: 200px;
  padding: 20px;
  border: 4px solid #1e3a8a;
  margin: 10px;
  border-radius: 8px;
  background-color: #eff6ff;
}

Trace the arithmetic the way you would trace a formula in maths. The content is declared as 200px wide. Padding adds 20px on the left and 20px on the right (40px total) around that content. Border adds 4px on the left and 4px on the right (8px total) around the padding. So the element's own visible box width — the coloured rectangle you actually see on screen — is:

200 + (20 + 20) + (4 + 4) = 200 + 40 + 8 = 248px

Margin is not part of that visible box at all — it is reserved space around it. Add the 10px margin on each side and the total horizontal space this card claims on the page, including the empty gap before the next card starts, is:

248 + (10 + 10) = 268px

Two numbers, two different meanings: 248px is what you'd measure with a ruler on the coloured box; 268px is how far apart two card centres need to be so the cards don't touch. The diagram below labels every layer with these exact numbers.

CSS box model diagram showing content, padding, border and margin for a 200px-wide card whose height is set by its content margin: 10px on every side border: 4px solid padding: 20px on every side content 200px wide (height set by content) Visible box (content+padding+border) = 248 × 148px Total space claimed, including margin = 268 × 168px

Arranging pieces on the page: Flexbox

The box model tells you how one box is built. Flexbox tells you how a browser arranges several boxes next to each other. Picture a shelf on your wall with several photo frames on it: if you had to arrange them by hand, you'd probably want them in a neat row with equal gaps, and if you added a new frame, you'd want the row to reflow automatically rather than needing you to re-measure everything. Flexbox is the CSS tool that does exactly this reflowing for you, automatically, without you calculating a single pixel position.

You turn any container into a flex container with one declaration, and every direct child instantly becomes a flexible "item" arranged in a row by default:

nav {
  display: flex;
  gap: 20px;
}

#projects {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

For the <nav>, display: flex lines up the three links (About, Projects, Contact) in a single horizontal row with a consistent 20px gap between each, instead of them stacking one below another the way plain block elements would. For #projects, the same display: flex lines up the project cards side by side, and flex-wrap: wrap tells the browser: if the row runs out of horizontal space, start a new row rather than squeezing the cards or letting them overflow. This single property is what makes a project gallery look tidy whether the visitor has two projects or twenty.

Designing like a professional, not a decorator

Here is a second misconception worth correcting directly, because it shapes every visual decision you'll make: many beginners equate "professional-looking" with "maximum colour, maximum animation, maximum decoration." In practice, the opposite is closer to true. Professional portfolios are judged by clarity, consistency, and restraint — a visitor should be able to scan your page and find your best project within a few seconds, and nothing should compete for attention with the content itself. Three concrete habits produce this effect: pick two or three colours total and reuse them everywhere (our examples use a small navy-and-blue palette, not a rainbow); keep font choices to at most two (one for headings, one for body text); and leave generous empty space around blocks of content rather than filling every pixel — that empty space is called whitespace, and it is a deliberate design tool, not "wasted" area. A page with fewer, well-organised elements consistently reads as more credible than a page with more decoration, because restraint signals that you made intentional choices rather than adding everything you knew how to do.

Making it work on every screen: responsive design

A portfolio is frequently opened first on a phone, since a smartphone is the primary or only computer many students and families in India actually own and use daily. If your layout assumes a wide laptop screen, a three-card-wide row of projects will either overflow the phone's screen or shrink each card until the text is unreadable. Two techniques fix this, and both must be understood, not just copy-pasted.

First, the viewport meta tag, already present in our HTML head — <meta name="viewport" content="width=device-width, initial-scale=1.0"> — tells the phone's browser "render this page at the phone's actual pixel width, don't pretend you're a 980px-wide desktop and then zoom out." Without this single line, most phones display a tiny, zoomed-out version of a desktop layout by default, which is why it's one of the most important tags on the page despite being invisible.

Second, a media query lets your CSS apply different rules depending on the screen's width, using an @media block:

@media (max-width: 480px) {
  nav {
    flex-direction: column;
  }
  #projects {
    flex-direction: column;
  }
}

Read this the way you'd read a conditional statement in programming: "if the screen width is 480 pixels or less, then apply the rules inside these braces; otherwise ignore them." Here, on narrow phone screens, we override flex-direction from its default value of row to column, stacking the navigation links and project cards vertically instead of forcing them into a cramped horizontal row. Nothing about the HTML changes — the same file, same tags — only the CSS instructions applied to it change based on available width. This is the core idea of responsive design: one set of content, multiple layouts, chosen automatically by screen size.

From your computer to the world: publishing the site

A finished set of files sitting only on your own laptop is not yet a "website" — it is a website's ingredients. A folder for a real project typically looks like this, kept organised so files can find each other correctly:

portfolio/
├── index.html
├── style.css
├── script.js
└── images/
    └── profile.jpg

index.html is not an arbitrary name — every standard web server, when given a folder address, automatically looks for a file called exactly index.html to display, so this is the one filename you must never change. Publishing means copying this folder onto a server, a computer built to stay switched on and connected to the internet so anyone can request your files at any hour. GitHub Pages is a free, commonly used service that turns a folder of exactly these kinds of files into a live web address without you needing to manage a server yourself — you upload the folder, and it gives you a URL. Note the distinction between two words students often blur: hosting is the storage and serving of your files (what GitHub Pages provides for free); a domain is a memorable address you could optionally buy separately (like yourname.com) to replace a longer default address. A portfolio absolutely does not need a purchased domain to be real and shareable — free hosting with a default address is a completely legitimate, professional way to publish your first site.

A professional-portfolio checklist

Before treating a portfolio as finished, verify each of the following, because each one is a specific, checkable failure mode, not vague advice:

  • Every image has an alt attribute — for example <img src="profile.jpg" alt="Photo of Aditi Sharma"> — so a screen reader can describe it and so text still makes sense if the image fails to load.
  • Every navigation link actually points somewhere that exists — a link to #projects only works if some element on the page has id="projects" exactly matching, including capitalisation.
  • Text colour has enough contrast against its background — pale grey text on a white background may look "modern" but is genuinely hard for many visitors to read.
  • The page has exactly one <h1> — your name or main title — with <h2> used for section titles beneath it, preserving a logical outline rather than skipping heading levels for visual size alone.
  • The contact method actually works — a typo in an email address is invisible to you but invisible-and-fatal to anyone trying to reach you.

Check your understanding

  1. A classmate writes an entire portfolio using only <div> tags with inline style attributes on each one. Name two concrete problems this causes, one related to accessibility and one related to future maintenance.
  2. A .card rule sets width: 150px, padding: 10px, and border: 2px solid black, with no margin declared. What is the visible width of the card in pixels? Show the arithmetic.
  3. Explain, in one sentence each, the difference between what padding does and what margin does — without using the word "space" in either sentence.
  4. Why does <meta name="viewport" content="width=device-width, initial-scale=1.0"> matter specifically for a visitor opening your site on a phone?
  5. Your project cards are arranged with display: flex but without flex-wrap: wrap. What visibly goes wrong when you add a sixth card on a narrow screen, and which single property fixes it?

Summary

A professional portfolio website is built from three separated languages — HTML for structure, CSS for appearance, JavaScript for behaviour — kept in separate files so a single change updates the whole site rather than requiring you to hunt through scattered inline styles. Semantic tags like <header>, <nav>, <main>, <section>, <article>, and <footer> give every container a real meaning instead of an anonymous <div>, which helps both screen readers and your own future edits. Every element the browser paints follows the same box model, nested from the inside out as content, then padding, then border, then margin, and confusing padding with margin is a specific, nameable bug rather than a vague styling mistake. Flexbox arranges sibling elements automatically, in a row by default, wrapping to new rows when told to. Restraint in colour, font, and decoration reads as more professional than maximal decoration, because it signals deliberate choices. Responsive techniques — a correct viewport tag plus media queries — let one set of content adapt to phone and laptop screens alike, which matters because a phone is often the first and primary device a visitor uses. Finally, a portfolio only becomes real once it is published to a host such as GitHub Pages, distinct from an optional purchased domain, at which point it stops being a school assignment and becomes the first genuine entry in the portfolio it describes.

Think About It

Think about this: How would you explain building a professional portfolio website to a friend who has never seen a computer? What real-world analogy would you use? Imagine you had to build a system using these concepts — what would be your first step? Try this: before moving on, write down three things you learned and one question you still have.

← Sorting Algorithms: From Cards to MillionsRecursion Through the Tower of Hanoi →

Found this useful? Share it!

📱 WhatsApp 🐦 Twitter 💼 LinkedIn