How to Build Your First Website Using HTML, CSS and JavaScript
Have you ever visited a website and wondered how it was made? Perhaps you have thought about creating one yourself, but the code on the screen looked too complicated to understand.
I remember that the hardest part of starting something new is often knowing where to begin. Web development is no different. There are new words, unfamiliar files and plenty of code to look at. But you do not need to learn everything at once.
In this tutorial, we will build a small website called BrightAtlas. We will start with an empty folder, create three files, write the code and open the finished page in a browser.
You will use HTML for the page structure, CSS for the design and JavaScript for a simple interactive button. By the end, you will have a working project on your own computer—not just a collection of code examples.
What We Are Going to Build
Our finished page will have a navigation bar, a welcome section, an About section, three learning cards and a contact area. We will also add a button that responds when someone clicks it.
It is a small project, but it brings together the same basic building blocks used in much larger websites.
Our project will contain these three files:
- index.html — the content and structure of the page.
- style.css — the colours, layout, spacing and visual design.
- script.js — the JavaScript that makes the button interactive.
What You Need Before Starting
You need a computer, a modern browser and a code editor. We will use Visual Studio Code (VS Code), which is free to download.
Download VS Code from its official website:
Install the version for your operating system. Once installation is complete, open the editor.
If you are unfamiliar with VS Code, its official Getting Started Guide explains the main parts of the editor.
Step 1: Create Your Website Project Folder
First, we need a place to keep the files for our website. On Windows, open File Explorer and choose a location where you can easily find your work, such as the Desktop or Documents folder.
- Right-click an empty area.
- Select New → Folder.
- Name the folder
BrightAtlas-MyWebsite. - Open Visual Studio Code.
- Select File → Open Folder.
- Choose the folder you just created.
Now look at the Explorer panel on the left side of VS Code. Your project folder should appear there.
Create the three files
Move your pointer over the folder name and click the New File icon. Create these files one by one:
BrightAtlas-MyWebsite/
│
├── index.html
├── style.css
└── script.js
Check the spelling carefully. The names must match exactly. For example, index.html.txt is not the same as index.html.
Step 2: Build the Page with HTML
Open index.html. If the file already contains anything, replace it with the code below.
HTML stands for HyperText Markup Language. Think of it as the framework of a webpage. It tells the browser where the headings, paragraphs, links, buttons and other content belong.
Write your first HTML code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Explore more, learn smarter and grow faster with BrightAtlas.">
<title>BrightAtlas | My First Website</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<header class="site-header">
<div class="logo">
<span class="logo-icon">✦</span>
BrightAtlas
</div>
<nav class="navigation">
<a href="#home">Home</a>
<a href="#about">About</a>
<a href="#services">Services</a>
<a href="#contact">Contact</a>
</nav>
</header>
<main>
<section class="hero" id="home">
<div class="hero-content">
<p class="eyebrow">EXPLORE • LEARN • GROW</p>
<h1>Welcome to <span>BrightAtlas</span></h1>
<p class="hero-description">
A simple website built with HTML, CSS and JavaScript.
Start your journey into the world of web development.
</p>
<button id="learn-btn" class="primary-btn">
Get Started
</button>
<p id="msg" class="message" aria-live="polite"></p>
</div>
</section>
<section class="about section" id="about">
<p class="eyebrow">GET TO KNOW US</p>
<h2>About BrightAtlas</h2>
<p>
BrightAtlas is a learning-focused project created to
demonstrate how a modern website can be built using
basic web development technologies.
</p>
</section>
<section class="services section" id="services">
<p class="eyebrow">WHAT WE PRACTICE</p>
<h2>Our Learning Areas</h2>
<div class="service-grid">
<article class="service-card">
<div class="card-icon">🌐</div>
<h3>HTML</h3>
<p>Build the structure and content of a web page.</p>
</article>
<article class="service-card">
<div class="card-icon">🎨</div>
<h3>CSS</h3>
<p>Give your website colour, style and layout.</p>
</article>
<article class="service-card">
<div class="card-icon">⚡</div>
<h3>JavaScript</h3>
<p>Add interaction and useful behaviour.</p>
</article>
</div>
</section>
<section class="contact section" id="contact">
<p class="eyebrow">SAY HELLO</p>
<h2>Keep Learning!</h2>
<p>Every experienced developer started with a first project. This is yours.</p>
<a class="contact-link" href="mailto:hello@example.com">
Contact by Email
</a>
</section>
</main>
<footer class="site-footer">
<p>© 2026 BrightAtlas. Built for learning.</p>
</footer>
<script src="script.js" defer></script>
</body>
</html>
Press Ctrl + S to save your work.
What do these HTML elements do?
You do not have to memorise every tag today. It is more useful to understand why each part is there.
<head>contains page information and links to external files.<body>contains the content visitors can see.<header>holds the website name and navigation.<main>contains the main page content.<section>groups related content together.<footer>holds information at the bottom of the page.
You will also see attributes such as class and id. They help us identify elements. CSS can style an element using its class, while JavaScript can find an element using its ID.
Step 3: Design the Website with CSS
Open style.css. This is where the page starts to look like a designed website rather than plain text.
CSS stands for Cascading Style Sheets. It controls colours, fonts, spacing, borders, layouts and how the page adapts to different screen sizes.
Add this CSS code
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html {
scroll-behavior: smooth;
}
body {
font-family: Arial, Helvetica, sans-serif;
background: #f4f7ff;
color: #17213b;
line-height: 1.7;
}
.site-header {
width: 100%;
padding: 20px 8%;
background: #101b3c;
display: flex;
align-items: center;
justify-content: space-between;
gap: 20px;
flex-wrap: wrap;
}
.logo {
color: #ffffff;
font-size: 25px;
font-weight: 800;
}
.logo-icon {
color: #25d9ff;
margin-right: 8px;
}
.navigation {
display: flex;
gap: 28px;
flex-wrap: wrap;
}
.navigation a {
color: #ffffff;
text-decoration: none;
font-size: 15px;
font-weight: 600;
}
.navigation a:hover {
color: #25d9ff;
}
.hero {
min-height: 570px;
padding: 90px 8%;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
color: #ffffff;
background:
radial-gradient(circle at top left,
rgba(35, 217, 255, 0.30), transparent 35%),
linear-gradient(135deg, #101b3c, #263f9b 55%, #7929a8);
}
.hero-content {
max-width: 760px;
}
.eyebrow {
color: #12c9e8;
font-size: 13px;
font-weight: 800;
letter-spacing: 3px;
margin-bottom: 16px;
}
.hero h1 {
font-size: clamp(38px, 6vw, 68px);
line-height: 1.15;
margin-bottom: 22px;
}
.hero h1 span {
display: block;
color: #31e0ff;
}
.hero-description {
max-width: 650px;
margin: 0 auto 30px;
font-size: 18px;
color: #e3eaff;
}
.primary-btn {
padding: 15px 35px;
border: none;
border-radius: 50px;
background: linear-gradient(90deg, #12c9e8, #287bff);
color: #ffffff;
font-size: 16px;
font-weight: 700;
cursor: pointer;
box-shadow: 0 8px 25px rgba(18, 201, 232, 0.3);
transition: transform 0.3s ease;
}
.primary-btn:hover {
transform: translateY(-4px);
}
.message {
min-height: 30px;
margin-top: 18px;
color: #8fffd2;
font-weight: 700;
}
.section {
padding: 85px 8%;
text-align: center;
}
.section h2 {
font-size: clamp(28px, 4vw, 40px);
color: #14234c;
margin-bottom: 20px;
}
.about > p:last-child,
.contact > p:not(.eyebrow) {
max-width: 700px;
margin: 0 auto;
color: #5b6680;
font-size: 17px;
}
.services {
background: #eaf1ff;
}
.service-grid {
max-width: 1050px;
margin: 40px auto 0;
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 24px;
}
.service-card {
padding: 35px 25px;
border-radius: 20px;
background: #ffffff;
box-shadow: 0 10px 35px rgba(26, 55, 110, 0.08);
transition: transform 0.3s ease;
}
.service-card:hover {
transform: translateY(-8px);
}
.card-icon {
font-size: 38px;
margin-bottom: 15px;
}
.service-card h3 {
color: #263f9b;
font-size: 22px;
margin-bottom: 10px;
}
.service-card p {
color: #64708a;
font-size: 15px;
}
.contact {
background: #ffffff;
}
.contact-link {
display: inline-block;
margin-top: 25px;
padding: 13px 28px;
border-radius: 40px;
background: #142c72;
color: #ffffff;
text-decoration: none;
font-weight: 700;
}
.site-footer {
padding: 25px 8%;
text-align: center;
background: #101b3c;
color: #d9e4ff;
font-size: 14px;
}
@media (max-width: 700px) {
.site-header {
justify-content: center;
text-align: center;
}
.navigation {
justify-content: center;
gap: 15px;
}
.hero {
min-height: 480px;
padding: 70px 6%;
}
.hero-description {
font-size: 16px;
}
.section {
padding: 65px 6%;
}
.service-grid {
grid-template-columns: 1fr;
}
}
Save the file. You have now added the visual design: a dark navigation bar, a colourful welcome section, learning cards and a mobile-friendly layout.
A quick explanation of the CSS
The body rule sets the default font, background and text colour. The .site-header rule uses Flexbox to position the logo and navigation links. The .hero rule creates the large welcome area with a gradient background.
The .service-grid rule uses CSS Grid to arrange the learning cards. Finally, the media query at the bottom changes the layout for smaller screens, so the cards stack into one column on a phone.
Step 4: Add Interaction with JavaScript
The page now has structure and design. But what should happen when someone clicks the Get Started button?
We can use JavaScript to make that happen. JavaScript is a programming language that lets a webpage respond to actions, update content and provide interactive features.
Open script.js and add this code:
const button = document.getElementById("learn-btn");
const message = document.getElementById("msg");
button.addEventListener("click", function () {
message.textContent =
"Great! You're now using JavaScript!";
button.textContent = "Keep Learning!";
});
Save the file using Ctrl + S.
What happens when the button is clicked?
The first two lines find the button and the paragraph where the message will appear. The addEventListener method tells JavaScript to wait for a click.
After the click, JavaScript changes the paragraph text and updates the button label. It is a small interaction, but it demonstrates how a webpage can respond to a visitor.
Step 5: Watch a Website Being Built from Scratch
Reading the instructions is useful, but sometimes it helps to watch another developer work through a project. The following English-language tutorial demonstrates a responsive website build using HTML, CSS and JavaScript.
What to pay attention to while watching:
- How the developer sets up the project in VS Code.
- How HTML elements are organised into sections.
- How CSS controls the navigation and page layout.
- How the website changes as the design develops.
This is a longer tutorial, so you do not need to finish it in one sitting. Use it as a companion lesson after completing the BrightAtlas project.
Step 6: Open Your Website in a Browser
Now it is time to see what you have made. You do not need to buy hosting or publish the project online just to test it on your computer.
- Open the
BrightAtlas-MyWebsitefolder in File Explorer. - Find
index.html. - Double-click the file.
- Your default browser should open the website.
You should see the BrightAtlas navigation bar, welcome section, learning cards, contact area and footer. Click the Get Started button. If the files are connected correctly, the button text will change and a message will appear.
If something does not work
Small mistakes are a normal part of learning to code. Before changing everything, check the basics.
- The page looks plain: Check that
style.cssis in the same folder asindex.htmland that its name is correct. - The button does nothing: Check the spelling of
script.js,learn-btnandmsg. - The browser shows an old version: Save all files and refresh. On Windows, try
Ctrl + F5. - You see an error: Open browser developer tools with
F12and check the Console tab.
Step 7: Test the Website on a Mobile Screen
A page that looks good on a laptop should also be comfortable to use on a phone. Our CSS already includes a media query that changes the learning cards into a single column when the screen is narrow.
To test the layout in Chrome or Edge:
- Open your website in the browser.
- Press
F12. - Look for the device toolbar icon, usually shown as a phone and tablet.
- Select a mobile device size.
- Check the navigation, text and learning cards.
The viewport setting in the HTML file helps the browser display the page at the device's actual width:
<meta name="viewport"
content="width=device-width, initial-scale=1.0">
The media query in CSS then adjusts the layout for smaller screens.
What You Have Learned
Take a look at the three files you created. Each one has a separate job, and together they make the website work.
| File | Purpose |
|---|---|
index.html | Creates the page structure and content. |
style.css | Controls design, colours, spacing and responsive layout. |
script.js | Adds interaction to the page. |
You have also worked with HTML elements, CSS selectors, Flexbox, Grid, media queries, JavaScript variables, DOM selection and click events.
These are beginner skills, but they are the foundation of front-end web development. More advanced websites build on the same ideas.
Try These Small Changes Yourself
Before moving to another tutorial, spend a little time experimenting with your project. You will remember more by making changes yourself than by simply reading the code again.
- Change the website name: Replace BrightAtlas in the HTML file with your own project name.
- Try different colours: Change the gradient values in the
.heroCSS rule. - Add another learning card: Copy one existing
service-cardblock and give it a new heading. - Personalise the button message: Change the text inside
message.textContentin JavaScript.
Where to Go After Your First Website
Once you are comfortable with this project, you can try building something a little more personal. A portfolio website is a good next step because it gives you a place to display your work. You could also build a café website, a blog layout or a landing page for a small business.
After you have practised HTML, CSS and JavaScript, you can explore Git, APIs, backend development with Node.js and databases. There is no need to rush through these topics. Build a solid foundation first.
Common Beginner Questions
Can I build a website without previous coding experience?
Yes. Start with a small project and learn one concept at a time. You do not need to understand every line before you begin. Follow the steps, experiment and look up unfamiliar terms as you encounter them.
Is Visual Studio Code free?
Yes. Visual Studio Code is available as a free code editor. Download it from the official VS Code website.
Do I need to pay for hosting?
No. You can create and test this project locally on your computer without paying for hosting. Hosting is needed when you want to make the website publicly accessible online.
Can HTML, CSS and JavaScript build a professional website?
Yes. They are core front-end technologies used to create website content, design and interactive behaviour. Larger projects may also require a backend, database, APIs and additional security measures.
Does this project include a working contact form?
No. The example includes an email link, not a form that stores or sends messages through a backend. A real contact form needs a suitable form service or backend to process submissions.
Will my website automatically appear on Google?
No. Building a website does not guarantee that Google will index it. You need to publish it online and follow good technical and search indexing practices.
Final Thoughts
Your first website does not need to look perfect. The important thing is that you now know how the pieces fit together. You created a folder, wrote HTML, styled the page with CSS, added a JavaScript interaction and tested the result in a browser.
When something does not work, take a breath and check it one step at a time. Every developer has to troubleshoot. Learning to find and fix small mistakes is part of becoming comfortable with coding.
Keep experimenting. Keep building. Your next project will be easier because you have already started.
Explore More. Learn Smarter. Grow Faster.
Further Learning: Official Resources
- MDN — Learn Web Development: structured learning material for HTML, CSS and JavaScript.
- MDN — HTML: learn about HTML elements and page structure.
- MDN — CSS: explore styling and layout.
- MDN — JavaScript Guide: understand JavaScript fundamentals.
- Visual Studio Code Documentation: learn how to use the editor.
- Microsoft Learn — Get Started with Web Development: practise HTML, CSS and JavaScript in VS Code.
Comments
Post a Comment