March 18, 2024

How to run HTML?


You can use Notepad or other text editors (such as Visual Studio Code, sublime,...) to write the HTML file.


I am using Visual Studio Code here.


First, you can download Visual Studio Code using this link.


https://code.visualstudio.com/download



1) Open your visual studio code.


2) Take a new file and write your file name.


a) Click on File in New File.



b) Write the name of the file and add a .html extension behind the file name. Press Enter.



c) Choose the destination path from which you want to save your HTML file. Click on Create file.





3) Write the basic code of HTML. And save your file. If you want to understand the basic structure of HTML then visit this tutorial Basic Structure of HTML.





4) There are many ways to run an HTML file. Let us know the 3 ways here.


a) Right-click on your file name and choose Copy path. Open your browser and paste the path into a new tab.



You can see your file path in the address bar.



b) Right-click on your file and choose the Open with Live server. 


You can see the live server path in the address bar.



c) In your this PC go to your file path and double-click on your file.


 

Note: The file has to be run only once. After the file is run, save any changes you make in the HTML file and then refresh the page where your file has been run in the browser.


HTML