- What we will do in this part
- Choosing an editor: VS Code in five minutes
- Create the project folder and the first file
- A complete first HTML document
- See the result
- Add an image and check the tag
- The real test: mobile
- Validate the code before moving on
- Common first-page mistakes
- Summary and what comes next
- FAQ
- 🔗 Official sources
In this part you set up your workspace and write your first complete HTML page by hand.
Key fact: a plain text file named index.html is enough to show your page in a browser, and without the viewport tag the text looks tiny on mobile.
Follow the steps in order, then open the page in a mobile view and confirm the text is readable.
In part 1 we followed the journey of a page request from URL to rendered pixels. Today we pick up the tools: a free working environment, a complete first HTML page, and a browser check on desktop and mobile. By the end you have a working page on your own machine, ready to grow into the full site.
What we will do in this part
- Set up a free code editor, plus an option that needs no installation.
- Create the project folder and the first
index.htmlfile. - Write a valid HTML document from scratch.
- Open it in the browser and check it on desktop and mobile.
- Validate the code with the official validator before publishing.
1. Choosing an editor: VS Code in five minutes
Any text editor works, but VS Code is free, the most widely used editor for web work, and runs on Windows, macOS, and Linux.
- Open
code.visualstudio.comand download the build for your system. - Run the installer and keep the defaults (Next through to the end).
- Open the editor, press
Ctrl+Shift+Xfor extensions, and install two:- Arabic Language Pack if you prefer an Arabic interface.
- Live Server: serves your page locally and refreshes it on every save.
No-install option: if you cannot install software, use a browser editor such as CodePen or JSFiddle. The code is identical; the difference is that you cannot run PHP there, so we will need VS Code by part 5.
2. Create the project folder and the first file
- Create a folder named
my-siteon your desktop. - In VS Code choose File → Open Folder and select it.
- From the sidebar, click the new-file icon and name it
index.html, all lowercase.
The name index.html is not optional: it is the file a server serves automatically when a visitor opens the domain with no path.
3. A complete first HTML document
Copy this into the file and save with Ctrl+S:
<!doctype html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>My first page</title>
</head>
<body>
<h1>Welcome to my first website</h1>
<p>This is the first page I wrote myself, and I will build a full site on it.</p>
<h2>What will I learn in this series?</h2>
<ul>
<li>Writing valid HTML pages.</li>
<li>Styling them with a responsive layout.</li>
<li>Publishing them on the internet.</li>
</ul>
<p>Learn more: <a href="https://developer.mozilla.org/">MDN documentation</a></p>
</body>
</html>
Every line has a job:
<!doctype html>: tells the browser this is modern HTML; without it the browser falls back to legacy quirks mode.<html lang="en" dir="ltr">: page language and direction. For Arabic content uselang="ar" dir="rtl".<meta charset="utf-8">: character encoding. Omit it and non-Latin text turns into symbols.<title>: the tab title and the headline in search results.<h1>: the main heading, exactly one per page.<p>: a paragraph of text.<ul>and<li>: a bulleted list and its items.<a href="...">: a link, with its destination inhref.
4. See the result
Open the project folder and double-click index.html, or right-click it in VS Code and choose Open with Live Server.

The page has no styling, which is expected: we have not written any CSS yet. What matters is that the elements appear in the right order and the direction is correct.
5. Add an image and check the tag
Save any small image in the same folder as photo.jpg and add this line before the list:
<img src="photo.jpg" alt="A test image inside my first page" width="400">
src: the image path. When the file sits in the same folder, the name alone is enough.alt: the text shown if the image fails, read by screen readers and used by Google. Not optional.width: the display width in pixels, which also reduces layout shift while loading.
6. The real test: mobile
Press F12, toggle device mode with Ctrl+Shift+M, and pick a 390-pixel viewport. The text shrinks to a tiny size:

The cause: the browser assumes a desktop-width page (around 980 pixels) and scales the whole thing down to fit. The fix is one line inside <head>:
<meta name="viewport" content="width=device-width, initial-scale=1">
Save, reload, and see the difference:

Expected result: the text is readable and the link is easy to tap. This tag is the first requirement of any responsive design, and it belongs in every page you build from now on.
7. Validate the code before moving on
- Open the official W3C validator, choose Validate by File Upload, and upload your file.
- You should see No errors or warnings to show. If errors appear, read the line number and fix it.
- In the browser press
Ctrl+Uto view the source and confirm it matches what you wrote.
8. Common first-page mistakes
- Wrong file extension, such as
index.html.txt, which opens as plain text. The extension must be.htmlonly. - Forgetting
charset="utf-8", so non-Latin text shows as symbols. - Forgetting
dir="rtl"for Arabic pages, so text starts on the wrong side and punctuation lands oddly. - More than one
<h1>on a page, which confuses search engines. - Unclosed tags such as
<p>without</p>, which causes strange nesting later.
9. Summary and what comes next
You now have a project on your machine, a valid first page, a way to test it on mobile, and an official validator to check it.
In part 3 we build a proper page structure with semantic HTML (header, nav, main, section, footer), and see why the right element beats a <div> for everything, for both SEO and screen readers.
If you would rather have a finished site than build one yourself, you can request a website design service from the Noor4Tech team.
FAQ
Is VS Code really free?
Yes, fully free for personal and commercial use, with no subscription.
Do I need internet to open my page?
No. The page is a file on your machine and opens offline. Internet is only needed if the page loads images or fonts from an external site.
Why does the page have no colours or styling?
Because styling is CSS, which we have not written yet. HTML defines content and meaning; CSS defines appearance.
What is the difference between Live Server and opening the file directly?
For static pages the visible result is the same. Live Server reloads the browser on every save, and it matters later when we run PHP.
🔗 Official sources
- MDN: Creating the content
- MDN: HTML element reference
- W3C Markup Validation Service
- VS Code documentation
Series: part 2 of Build Your Website from Scratch — previous part: how a website works · series index · next: semantic HTML and page structure.
Comments (0)
No comments yet. Be the first to comment!
Add Your Comment