Welcome! In our last lesson, we installed the final piece of our developer toolkit, the 'Live Server' extension for VS Code. With our local setup now complete, we're ready to transition from preparation to creation.
1. What We Are Learning
This lesson kicks off Module 3: Quick Win: Your First Manual Web Page. Our goal is to create a project folder with a standard structure (index.html, styles/style.css).
Think of this as setting up a new, clean artboard in Figma. Before you add a single element, you create the file, name it, and maybe set up some initial guides. We're doing the digital equivalent for our website.
We will:
- Create a main folder for our project on your computer.
- Open this folder in VS Code.
- Create the two essential files every simple website needs: an HTML file for content and a CSS file for styling.
- Organize these files into a clean, professional structure.
2. Why This Matters
In design, you know that a well-organized Figma file—with clearly named layers, groups, and pages—is crucial for collaboration and maintainability. A messy file is a nightmare to work with, even for yourself a few weeks later.
The same principle is fundamental in web development. A logical folder structure makes your project:
- Understandable: Anyone (including you, collaborators, and even the AI tools we'll use later) can quickly grasp where everything is.
- Functional: Web browsers and servers are built to expect certain conventions. For example, they automatically look for a file named
index.htmlas the homepage. - Scalable: As your project grows from one page to many, a good structure prevents chaos.
To start, let's get a high-level overview of why this structure is so important and what the standard conventions are.
{Web-D 01} File and folder structure
This video, '{Web-D 01} File and folder structure', uses a great 'suitcase' analogy to explain the concept of a self-contained project folder. It also explains the critical role of the index.html file and the rules for naming files for the web.
Watch the video from the beginning until 9:05. Pay close attention to: The 'suitcase' or 'root folder' concept. Why the homepage must be named index.html. The rules for naming files (no spaces, no special characters).
3. Step-by-Step Instructions
Now, let's put that theory into practice. We will create our project folder and files. We'll start by using your computer's built-in file manager (Finder on Mac, File Explorer on Windows) and then move into VS Code.
The following guide from the Mozilla Developer Network (MDN) is an excellent resource that walks through the same process we're about to undertake. We'll follow its steps together.
Dealing with files: Web development
The article 'Dealing with files' from MDN provides detailed, step-by-step instructions for setting up a project folder. We'll use it to guide our setup.
You don't need to read this all at once. Keep it open as a reference as you follow the steps below. We will be following the sections from 'Manipulating files and folders' through 'What structure should a website have?'.
Step 1: Create Your Project Folders
First, we'll create a main folder to hold all your future web projects, and then a specific folder for this first landing page.
- Open your computer's file manager (Finder/File Explorer).
- Navigate to your Documents folder. This is a safe and easy-to-find place.
- Inside Documents, create a new folder named
web-projects. This will be the home for all the projects in this course. - Now, go inside the new
web-projectsfolder and create another new folder namedmy-landing-page. This is our root folder for this specific project—the "suitcase" from the video.
Step 2: Open the Project in VS Code
It's important to open the entire folder in VS Code, not just individual files. This tells the editor, "This folder is my entire workspace."
- Open VS Code.
- From the top menu, go to
File > Open Folder.... - In the window that appears, navigate to
Documents > web-projects, select themy-landing-pagefolder, and click "Select Folder" (or "Open"). - VS Code will likely ask if you trust the authors of the files in this folder. Since you created it, click "Yes, I trust the authors".
- You should now see
MY-LANDING-PAGEin all caps in the Explorer panel on the left side of VS Code. It will be empty for now.
Step 3: Create Your HTML and CSS Files
Now we'll create the files directly inside VS Code. This is the standard workflow. The following video shows this process visually.
VS Code for Absolute Beginners
The video 'VS Code for Absolute Beginners' by Coder Coder provides a very clear demonstration of how to create new files and folders within the VS Code Explorer.
Watch from 3:00 to 5:19 to see how to create files. Then, watch from 15:45 to 16:26 to see how to create a subfolder and move a file into it. This will show you exactly what we're about to do.
Let's do it:
-
Create
index.html:- In the VS Code Explorer panel, make sure no folders are selected. Hover your mouse near the
MY-LANDING-PAGEtitle, and click the "New File" icon. - A text box will appear. Type
index.htmland pressEnter. Your main HTML file is now created and opened in the editor.
- In the VS Code Explorer panel, make sure no folders are selected. Hover your mouse near the
-
Create the
stylesfolder:- Click on an empty area in the Explorer panel to deselect the
index.htmlfile. - Click the "New Folder" icon.
- Name the folder
stylesand pressEnter.
- Click on an empty area in the Explorer panel to deselect the
-
Create
style.cssinside thestylesfolder:- Important: First, click on the
stylesfolder in the Explorer to select it. This tells VS Code you want to create the new file inside this folder. - Click the "New File" icon again.
- Name the new file
style.cssand pressEnter.
- Important: First, click on the
You've done it! Your folder structure should now look like this in the VS Code Explorer:
my-landing-page/
├── styles/
│ └── style.css
└── index.html
This structure separates content (index.html) from presentation (style.css), which is a core principle of modern web development.
4. What Could Go Wrong
- File extensions are hidden: On Windows, file extensions like
.htmlor.cssmight be hidden by default. This can cause you to accidentally name a fileindex.html.txt.- How to fix: In the MDN article "Dealing with files," find the section called "File names". It provides instructions on how to show file extensions in Windows. For Mac, this is not usually an issue.
- Files in the wrong place: You might accidentally create
style.cssoutside thestylesfolder.- How to fix: Simply drag and drop the
style.cssfile onto thestylesfolder within the VS Code Explorer. It will ask you to confirm the move.
- How to fix: Simply drag and drop the
- Typos in names: Naming the file
idex.htmlor the folderstyleinstead ofstyles.- How to fix: Right-click the file or folder in the VS Code Explorer and choose "Rename". Carefully correct the name. Remember the rules: all lowercase, use hyphens instead of spaces, and name the homepage
index.html.
- How to fix: Right-click the file or folder in the VS Code Explorer and choose "Rename". Carefully correct the name. Remember the rules: all lowercase, use hyphens instead of spaces, and name the homepage
5. Mini Exercise
To reinforce what you've just learned, repeat the process with a practice project.
- Using your computer's file manager, go into your
web-projectsfolder. - Create a new project folder named
practice-project. - Open this new
practice-projectfolder in VS Code (you can useFile > Open Folder...or open a new VS Code window withFile > New Windowfirst). - Inside VS Code, create the file
index.html. - Create the folder
styles. - Inside the
stylesfolder, create the filestyle.css. - Check that your structure matches the one we created for
my-landing-page.
6. Checklist Before Moving Ahead
- I have a
web-projectsfolder in myDocuments. - Inside it, I have a project folder named
my-landing-page. - I have opened the
my-landing-pagefolder in VS Code. - Inside VS Code, I have created an
index.htmlfile at the root level. - I have created a
stylesfolder. - Inside the
stylesfolder, I have created astyle.cssfile. - I understand that
index.htmlis the special name for a homepage.
Conclusion
Congratulations! You have successfully created the foundational structure for your first website. This organized "scaffolding" is the mark of a professional workflow and will make the next steps much smoother. You now have a blank canvas (index.html) and a dedicated place for your paint palette (style.css).
A Look Ahead: In the next lesson, we will finally write some code! We'll add a "Hello, World" message to index.html to create the basic structure of a webpage. Get ready to see your first creation come to life in the browser.