HTML, CSS, JavaScript and PHP, explained for beginners
What each of the four website languages does, where each one runs, which you actually need to learn, and how to build your first page without installing anything.
On this page
Quick answer: HTML is the content of a web page, CSS is how it looks, JavaScript makes it respond in the visitor’s browser, and PHP runs on the web server to build pages before they’re sent. You can build a perfectly good first website with just HTML and CSS. You only need PHP or JavaScript when you want something to change or react.
If you’ve never built a website, the list of languages can feel like a wall. It isn’t one. Each of the four does a single, separate job, and you can learn them one at a time, in order, stopping whenever you have what you need.
Think of a website as a house
- HTML is the structure: the walls, rooms and doors. It says “this is a heading, this is a paragraph, this is a photo, this is a link”.
- CSS is the decoration: paint, furniture and lighting. Colours, fonts, spacing and layout all live here.
- JavaScript is the electrics: things that respond when you touch them, like a menu that opens or a form that checks your email address before sending.
- PHP is the builder working off-site: it puts pages together on the server, often from a database, before they’re delivered.
The first three run in the visitor’s browser. PHP runs on the web server, so the visitor only ever sees the HTML it produced.
HTML: the content
Every web page is an HTML file. HTML uses tags to label each piece of content:
<h1>Bramley Bakery</h1>
<p>Fresh bread every morning from 7am.</p>
<a href="contact.html">Find us</a>That’s a heading, a paragraph and a link. A browser reads those tags and shows the content accordingly. Your homepage is usually a file called index.html: it’s the file a web server shows when someone visits your domain.
CSS: how it looks
CSS is a list of rules that say how HTML should be displayed:
h1 { color: #1b3444; font-size: 2.5rem; }
p { line-height: 1.6; max-width: 60ch; }Keep your CSS in its own file (for example style.css) and link it from each page. Then changing the look of your whole site means editing one file.
JavaScript: things that respond
JavaScript runs in the browser after the page has loaded. Typical first uses are a mobile menu that opens and closes, a photo gallery, or checking a form before it’s sent. Plenty of small sites need none at all, and you can always add it later.
PHP: pages built on the server
With plain HTML, every visitor gets exactly the same file. PHP lets the server build the page on demand, which is how you get things like:
- a blog where you write posts in an editor rather than editing files
- a contact form that emails you what visitors type
- member logins, forums and online shops
Most of the time you won’t write PHP yourself: WordPress, forum software such as SMF and phpBB, and shops built on WooCommerce are all written in PHP, and you install them in a few clicks. PHP usually works with a MySQL (or MariaDB) database, where the posts, members and orders are stored.
Which do you need to learn?
| What you want | What you need |
|---|---|
| A few pages about you, your club or your business that rarely change | HTML and CSS |
| The same, plus a menu or gallery that responds | HTML, CSS and a little JavaScript |
| A blog, forum or shop you update through a dashboard | None: install WordPress, SMF or WooCommerce. PHP runs it for you |
| Something custom that stores data or has logins | HTML, CSS, JavaScript, PHP and SQL |
If your aim is simply to have a website, a content management system such as WordPress is the quickest route. If your aim is to understand websites, start by hand with HTML and CSS: it’s the best foundation for everything else.
What your hosting needs to support
- HTML, CSS and JavaScript files work on any web host, because the server just sends them as they are.
- PHP and a database need hosting that runs PHP and MySQL. Traxio accounts include PHP 7.4–8.4 (you can choose the version per domain) and a MySQL database.
Whatever you build, the files go in the public_html folder of your hosting account: that’s the folder the web server shows to the world. What public_html is for.
Five beginner mistakes, and how to avoid them
- Naming the homepage wrongly. It must be
index.html(orindex.php) inpublic_html, all lower case. - Mixing up capital letters. Web servers treat
About.htmlandabout.htmlas different files, even though your computer may not. Use lower case for every file and folder name. - Using paths from your own computer. A link to
C:\Users\you\site\photo.jpgworks on your machine and nowhere else. Use paths relative to the page, such asimages/photo.jpg. - Editing the live site with no copy. Keep the master copy on your computer, change it there, then upload. Then a mistake is never more than one upload away from being fixed.
- Wondering why changes don’t show. Browsers keep copies of CSS files. Do a hard refresh (Ctrl+F5 on Windows, Cmd+Shift+R on a Mac) before assuming something is broken.
Build your first page today
You don’t need to install anything. Any plain text editor will do (Notepad on Windows, TextEdit in plain text mode on a Mac, or a free code editor such as Visual Studio Code), plus your web browser to see the result. The create your first website from scratch tutorial walks through a complete small site in HTML and CSS, then puts it online on your own domain, one step at a time.
Do I need to learn to code to have a website?
No. Content management systems such as WordPress let you build and update a site through a dashboard, with no code. Learning a little HTML and CSS still helps when something doesn’t look right.
Which language should I learn first?
HTML, then CSS. Together they’re enough for a complete small website, and every other web technology builds on them.
Is JavaScript the same as Java?
No. They’re unrelated languages that happen to share part of a name. Websites use JavaScript.
Can I see the HTML of any website?
Yes. In most desktop browsers, right-click a page and choose “View page source”. It’s a good way to learn how other sites are put together.
Where this fits: Web hosting for beginners brings together everything you need for a first website, in order.
Reviewed against Traxio’s current service on 14 November 2026. Spotted something out of date? Tell us.