How websites work: HTML, CSS, and JavaScript
Covered here
- What happens when you type a website address
- The job of HTML, CSS, and JavaScript
- The house analogy for the three front-end languages
- Which one to learn first and why
Short answer
A website is a set of files stored on a web server. When you visit it, your browser requests those files and builds the page. HTML gives the page its structure, CSS controls how it looks, and JavaScript makes it interactive. These three are called front-end languages because they run in the browser, on the visitor's side.
What happens when you visit a website
- You type
freecourses.digitalin the address bar. - DNS, the internet’s phone book, turns that domain name into an IP address of a server.
- Your browser sends an HTTP request to that web server.
- The server sends back an HTML file, plus CSS, JavaScript, and images.
- The browser renders everything into the page you see.
All of this happens in about one to two seconds on a good connection.
Three languages, three jobs
| Language | Job | Example |
|---|---|---|
| HTML | Structure and meaning | This is a heading, this is a button |
| CSS | Style and layout | The heading is blue, the button is rounded |
| JavaScript | Behavior | Clicking the button opens a menu |
Think of building a house. HTML is the frame: walls, rooms, doors. CSS is the paint, tiles, and furniture. JavaScript is the electricity: lights that switch on, a gate that opens.
See them working together
<button class="order">Order now</button>
<style>
.order { background: green; color: white; }
</style>
<script>
document.querySelector(".order").onclick = () => alert("Salamat!");
</script>
The HTML creates the button. The CSS paints it green. The JavaScript shows a message when someone clicks.
Front end vs back end
The front end is what runs in the visitor’s browser: HTML, CSS, JavaScript. The back end runs on the server: languages like PHP, Python, or Node.js, plus a database. WordPress, for example, uses PHP on the back end to generate HTML for the front end.
No matter which back end a site uses, the browser always receives HTML in the end. That is why HTML is the first skill to learn.
Try it: add style
The HTML is already here. Change the color value in the style block, for example from teal to crimson, and watch the heading change.
Live preview
Quick quiz
Common mistakes
- Styling with HTML tags. Old tags like <font> and <center> are obsolete. Use CSS for looks.
- Starting with JavaScript frameworks. React and Vue are easier once you know plain HTML and CSS.
- Mixing up front end and back end. HTML, CSS, and JavaScript run in the browser. PHP and databases run on the server.
Your action
Tick each item when you can do it. Your progress saves on this device.
Key terms
- Web server
- A computer that stores website files and sends them to browsers.
- Domain name
- A readable website address, like freecourses.digital.
- DNS
- Domain Name System, which turns domain names into IP addresses.
- HTTP request
- The message a browser sends to ask a server for a file.
- CSS
- Cascading Style Sheets, the language for styling HTML.
- JavaScript
- The programming language that makes pages interactive.
- Front end
- The part of a website that runs in the visitor's browser.
Questions beginners ask
Should I learn HTML and CSS together?
Learn HTML first for a week or two, then add CSS. They work as a pair, but structure comes first.
Is WordPress HTML?
WordPress is a content management system written in PHP. It outputs HTML to the browser, and you can edit HTML in its block editor.
Do I need JavaScript for a simple website?
No. A business page with text, images, links, and a contact form works with HTML and CSS alone.
What is a static website?
A static website is a set of ready-made HTML files served as they are, without a database. It is fast and cheap to host.
Related lessons
Need a website built or fixed while you practice? The team at Remar Digital can help.