HTML/CSS for Beginners / Chapter 1 — HTML basics (lessons 1–5) / Lesson 1
Setting up and your first page
Time needed: about 7 min (estimate)
Reading settings
These settings are remembered on this device only.
You can try the opening of this lesson without an account.
The division of labor between HTML and CSS
In a sentence, HTML is responsible for the structure and meaning of the document and CSS for its appearance.
By analogy with a paper document, HTML is the composition itself — "title", "body text", "bullet list" — while CSS is the formatting: fonts, text color, spacing.
This division pays off because you can swap the appearance while leaving the HTML alone.
If you are rewriting HTML merely to change how something looks, you are almost certainly doing it wrong.
What happens without tags
Open a file with not a single tag in a browser and the text appears, but the line breaks vanish and it runs together on one line.
To the browser it is nothing but a sequence of characters.
Telling the browser which part is a heading and which is body text is exactly what tags are for.
Creating your working folder and index.html
Create a portfolio folder somewhere you will find it, and open it with "Open Folder" in VS Code.
Save a new file under the name index.html.
That name matters: when a folder is requested, a web server returns index.html by default.
Remember that the top page's filename is index.html.
If your system hides file extensions it may have become index.html.txt, so check that one thing.
Writing the HTML skeleton
Open a .html file in VS Code, type an ! and press Tab, and the whole skeleton appears at once (a feature called Emmet).
The same thing is in the editor below.
Press "Preview" and the result appears underneath.
Change the contents of the <h1> to your own name and press it again.
Tab indents. To leave the editor, press Esc, then Tab.
Create a free account to keep reading
With an account you can read the rest of this lesson, take the quiz, and read every free lesson in this course. Lessons you answer correctly are recorded as complete.
Report a problem with this lesson
Log in to send a report.