You are currently viewing How to build a simple website using HTML and CSS

How to build a simple website using HTML and CSS

Building a website might sound difficult at first, but with just HTML and CSS, you can easily create your own simple and functional website, even as a beginner. Whether you’re a student, freelancer, or aspiring web designer, this guide will walk you through the basic steps to build a clean, professional-looking website from scratch.

What Are HTML and CSS?

HTML (HyperText Markup Language) is the structure or skeleton of every website. It organizes the content — text, images, links, and headings — on a page.

CSS (Cascading Style Sheets) adds life and beauty to that structure. It controls colors, layouts, fonts, and spacing to make your site visually appealing.

Together, HTML and CSS form the foundation of web development.

Step 1: Set up your project folder

Start by creating a new folder on your computer. You can name it “MyWebsite”. Inside it, create two files:

index.html – This will hold your website’s main content.

style.css – This will contain your design and styling rules.

Step 2: Write the basic HTML structure

Open index.html using a text editor like VS Code, Notepad, or Sublime Text, and type the following code:

<!DOCTYPE html><html lang="en"><head>  <meta charset="UTF-8">  <meta name="viewport" content="width=device-width, initial-scale=1.0">  <title>My Simple Website</title>  <link rel="stylesheet" href="style.css"></head><body>  <header>    <h1>Welcome to My Simple Website</h1>    <p>This is my first website built using HTML and CSS.</p>  </header>  <section>    <h2>About Me</h2>    <p>I’m learning how to build websites from scratch using HTML and CSS. It’s simple and exciting!</p>  </section>  <footer>    <p>© 2025 My Simple Website | Designed by Me</p>  </footer></body></html>

This code creates a basic layout with a header, a content section, and a footer.

Step 3: Add Styling with CSS

Now, open your style.css file and paste the following code:

body {  font-family: Arial, sans-serif;  background-color: #f4f4f9;  margin: 0;  padding: 0;  color: #333;}header {  background-color: #0078d7;  color: white;  text-align: center;  padding: 20px;}section {  padding: 20px;  text-align: center;}footer {  background-color: #222;  color: white;  text-align: center;  padding: 10px;}

This CSS code styles your webpage by adding background colors, text alignment, and spacing, giving it a polished and modern look.

Step 4: Open and test your website

Save both files, then open your index.html file in a web browser. You’ll see your first complete website live on your screen!

Step 5: Customize and Improve

You can make your website more interesting by:

  • Adding images using the <img> tag
  • Creating links with the <a> tag
  • Designing navigation menus
  • Experimenting with colors, layouts, and fonts in your CSS file

Why learn HTML and CSS?

Learning HTML and CSS opens the door to endless opportunities. You can:

  • Build your personal portfolio or blog
  • Design landing pages for businesses
  • Customize WordPress or other CMS themes
  • Start freelancing or explore a web development career

Building a simple website using HTML and CSS doesn’t require advanced coding skills or expensive tools, just creativity, patience, and practice. Once you master the basics, you can move on to more advanced topics like JavaScript, responsive design, and frameworks such as React or Bootstrap.

Top 5 tech careers in high demand in Ghana (2025 edition)