Your First Page: Save It, Open It, See It Break
Create a .html file, open it in the browser, fix the blank-page mistakes beginners hit, and set up a folder for every example in this course.
Course content
Sign in to save your progress.
-
Before You Write Markup
-
What HTML and CSS Actually Do in Your Browser
-
Your First Page: Save It, Open It, See It Break
-
-
-
HTML You Cannot Skip
-
Tags, Elements and Attributes Without the Fog
-
Headings, Paragraphs, Links and Images That Mean Something
-
Semantic HTML: Stop Wrapping Everything in a Div
-
-
-
Structure That Helps the Reader
-
Lists and Tables When You Actually Need Them
-
Forms That Submit Without Confusing the User
-
-
-
CSS Basics You Cannot Skip
-
Selectors, Classes and Why Inline Styles Bite You Later
-
The Box Model: Margin, Border, Padding, Content
-
Colors, Fonts and Units That Don't Fight You
-
-
-
Making It Look Like a Real Page
-
Cascade and Specificity Without Guessing
-
Inspect and Fix Styles in Browser DevTools
-
-
- Final Check: HTML and CSS for Beginners
Skip ahead: If you already open local .html files in the browser and fix a blank page without panicking, skip to "A folder for this course", then continue.
Your first page will break. That is normal. The goal of this lesson is to create a file, open it, recognise the usual blank-page causes, and set up a folder you will reuse for every example.
Create the file
- Create a folder named
htmlcss-coursesomewhere easy to find, for example on your Desktop. - Open a plain text editor (Notepad, Notepad++, VS Code, or similar). Not Word. Word adds formatting that breaks HTML.
- Paste this:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>My first page</title>
</head>
<body>
<h1>It worked</h1>
<p>If you can read this, the file opened as HTML.</p>
</body>
</html>
- Save as
index.htmlinsidehtmlcss-course. The extension must be.html, not.txtand not.html.txt.
⚠ Warning: On Windows, turn on file name extensions in File Explorer (View → Show → File name extensions). Otherwise you may think you saved index.html while the real name is index.html.txt, and the browser will not treat it as HTML.
Open it in the browser
Ways that work:
- Double-click
index.html(opens in your default browser). - Or drag the file onto a Chrome or Edge window.
- Or in the browser: Ctrl+O (Cmd+O on Mac) and pick the file.
The address bar should start with file:/// and end with index.html. You should see "It worked" as a heading.
When it looks blank or wrong
Check these in order. Most "my page is broken" reports are one of them.
- Wrong extension. If the tab shows the raw tags as text, or the file icon looks like a text document, rename it so it ends in
.htmlonly. - You edited a different copy. Search your disk for another
index.html. Open the one inhtmlcss-courseagain. - The file didn't save. Change the heading to
It worked 2, save, reload the browser tab (F5). If the old text stays, you are looking at an unsaved buffer or the wrong file. - Broken tags. Delete a closing
</h1>on purpose, save, reload. Some browsers still show content; some hide a chunk. Put the tag back. Get used to Save → Reload as your loop.
<!-- Broken on purpose: missing </h1> -->
<h1>It worked
<p>The heading never closed.</p>
Fix:
<h1>It worked</h1>
<p>The heading closed.</p>
Add a stylesheet next to the page
Create styles.css in the same folder:
body {
font-family: Arial, sans-serif;
margin: 2rem;
color: #080b0e;
}
h1 {
color: #034bff;
}
Link it from the HTML <head>:
<link rel="stylesheet" href="styles.css">
Save both files. Reload. The heading should turn blue. If it does not:
- Confirm
styles.cssis in the same folder asindex.html. - Confirm the
hrefspelling matches the file name exactly (case matters on some systems). - Open DevTools (F12) → Network, reload, and see if
styles.cssis 404.
A folder for this course
Keep one folder per lesson if you like, or one folder with many files. What matters:
- HTML and its CSS live together or with clear relative paths.
- You open the HTML file, not the CSS file, in the browser.
- You never paste course examples into a live production site without reviewing them.
💡 Tip: Bookmark file:///.../htmlcss-course/index.html or pin the folder. You will open it dozens of times.
What happens if you skip this
If you only follow screenshots in an online sandbox, you will not know how files on your computer map to what the browser shows. The first offline assignment then feels like a different subject.
Open your page now. Change the paragraph text. Save. Reload. Did the browser show the new words? If yes, you have the loop this course depends on.
About
Create a .html file, open it in the browser, fix the blank-page mistakes beginners hit, and set up a folder for every example in this course.
- Duration
- 5 min
- Last update
- 08/11/2026
Comments (0)
Sign in to commentNo comments yet.