HTML Setup
Let's get our hands dirty and start preparing to write some code. In this tutorial, we will install VS Code and some related extensions for faster and more efficient HTML development.
What are the prerequisites to learning HTML?
I can safely say that there are no prerequisites to learning HTML. HTML is the language of the web and is often the first step that web developers take in learning to code.
Tools needed to make an HTML page:
- HTML Editor: It's a straightforward tool where every piece of HTML content must be written. You can use any text editor of your choice. In this tutorial, we're using Visual Studio Code because it's lightweight and open-source.
- Popular editors for HTML development include text editors like Notepad++, Sublime Text, and Visual Studio Code. Online platforms like MSK Web Editor are also commonly used for quick HTML editing and testing.
- Browser: HTML tags are not displayed by browsers; instead, they are read and interpreted to render the web page. In a web browser, HTML structures are displayed in a styled and visually appealing form. In this tutorial, we are using Google Chrome. Other commonly used browsers include Chromium, Firefox, Safari on Mac, and Microsoft Edge.
Setting Up Visual Studio Code
Setting up an HTML project in Visual Studio Code (VS Code) is straightforward. Here’s a step-by-step guide to get you started:
Step 1: Download VS Code
- Open your browser and search for
VS Code Download
, then pressEnter
. - Click on the first website in the search results.
- Click the
Download
button.
Step 2: Installation of VS Code
- Open the
Downloads
folder in your file manager. - Select the
VS Code Setup
file, then right-click it and choose theOpen
option from the pop-up menu. - In the setup window, check the box indicating
I accept the agreement
, then click theNext
button. - Select all the checkbox options, then click the
Next
button. - The installer will automatically start the
Preparing to Install
process. - Wait for the installation process to
complete
. - Once the installation process is complete, uncheck the box for
Launch Visual Studio Code
. - Finally, click the
Finish
button.
Step 3: Set Up Your Project Folder
- Create a New Project Folder:
- Open your
file explorer
and create anew folder
for your project (e.g.,html-project
).
- Open your
- Open the Project Folder in VS Code:
- Right click on created
New Folder
. then bottom side selectshow more options
. - After that select
Open with Code
.
- Right click on created
- Create a New File:
- In the Explorer sidebar (usually on the left), right-click on your project folder and select
New File
. - Name your file with a
.html
extension (e.g.,index.html
). - Open your
index.html
file and add the following basic HTML template:<!DOCTYPE html> <html> <head> <title>Page Title</title> </head> <body> <h1>MSK Institute</h1> <p>Best for learn coding in Shikohabad.</p> </body> </html>
- In the Explorer sidebar (usually on the left), right-click on your project folder and select
Step 4: Install Live Server (Optional)
To view your HTML file in the browser and see changes in real time, you can use the Live Server extension.
- Install Live Server:
- Go to the Extensions view by clicking on the Extensions icon in the Activity Bar on the side
of the window or pressing
Ctrl + Shift + X
. - Search for "Live Server".
- Click on the
Install
button for the Live Server extension by Ritwick Dey.
- Go to the Extensions view by clicking on the Extensions icon in the Activity Bar on the side
of the window or pressing
- Run Live Server:
- After installation, right-click on your
index.html
file in the Explorer and selectOpen with Live Server
. - Your default web browser will open, displaying your HTML file. Any changes you make to the HTML will automatically refresh in the browser.
- After installation, right-click on your
Step 5: Organize Your Project (Optional)
For larger projects, consider organizing your files by creating subfolders such as:
css/
- for your CSS filesjs/
- for your JavaScript filesimages/
- for your images
Step 6: Customize VS Code (Optional)
You can further customize VS Code with:
- Syntax Highlighting: VS Code supports HTML syntax highlighting out of the box.
- Emmet: Use shortcuts like
!
followed byTab
inside an HTML file to generate boilerplate code. - IntelliSense: Get code suggestions and auto-completion for HTML tags and attributes.
Now you have a basic HTML setup in VS Code, ready for development! Happy coding!