Run an HTML file

Table of contents:

Run an HTML file
Run an HTML file

HTML (Hypertext Markup Language) is an Internet-oriented scripting language. It is mainly used for structuring the design and function of websites. Any file that contains HTML code is saved with the extension ".HTML". All modern browsers, such as Google Chrome, Safari and Mozilla Firefox recognize this type of file and can open it.


Method 1 of 3: Saving an HTML file

Run a HTML File Step 1

Step 1. Understand HTML

HTML is an abbreviation for Hypertext Markup Language. HTML files are text files that define the content and layout of a web page. To read an HTML file, you need a text editor (such as Notepad, Notepad++, or a special HTML editor). If you want to see how the program code appears, you'll need to run it in a web browser made for reading and processing HTML files.

Run a HTML File Step 2

Step 2. Write or copy HTML in a simple text editor

If you're a bit more experienced as a programmer, you can start using HTML editors like Adobe Dreamweaver, Microsoft Expression Web, and Coffee Cup HTML Editor, but a simple editor is essentially all you need to get started. Notepad (Windows) or TextEdit (Mac) should suffice.

Run a HTML File Step 3

Step 3. Save the file as your-file.html

If you're creating an HTML file in Notepad, TextEdit, or another text editor, be sure to save it with the correct extension. Make sure you have changed the file type to "All files" (if necessary) via "Save as type" and click "Save".

Method 2 of 3: Running an HTML file

Run a HTML File Step 4

Step 1. Make sure you have a browser installed on your computer

To view an HTML file on your computer, you need a browser.

Run a HTML File Step 5

Step 2. Locate the saved file

If you suspect the file is in a particular folder, but you can't find it, try searching your computer for it. Type your-file.html into the search box on the Start menu (on Windows) or the search box in Finder (on the Mac).

HTML files are usually in a folder with the same name as the.html file, but without the.html extension. The folder can contain various files such as.js.css, images and other files. Don't worry about those files. They are files that are necessary for the layout and functionality of the page. It is important that those files are not deleted. Leave them in the same directory (folder) as the HTML file, otherwise the page will not display properly. If you like to modify an HTML file, you will have to learn to code in HTML and other scripting languages

Run a HTML File Step 6

Step 3. Right-click (Windows) or double-click (Mac) the file and select "Open With" from the menu

You can now choose from one of several browsers installed on your computer, but the default browser will be at the top of the list. Open the file with a browser: Mozilla Firefox, Google Chrome, Safari, etc.

  • Most computers will associate the default browser with the.html extension. That means you don't normally have to look up a browser to open the file-you can just double-click it and the computer will open it in your default browser.
  • If your computer does not recognize the file, Windows will ask if the file should be opened with an already installed program or if a program suitable for that extension should be downloaded from the Internet. Select the "Select a program from a list of installed programs" option. You can then choose from a list of browsers installed on your system.
Run a HTML File Step 7

Step 4. View the HTML file in the chosen browser

The browser will automatically interpret and display your code. You can see the location of the file in the address bar - that way you know for sure that the correct HTML file is open, and not another file.

Run a HTML File Step 8

Step 5. Alternative method: Start your browser, and press Ctrl-O

This should display the "Open" window. Find your file, double click on it and your file will open in a new tab in your browser window. Different browsers can use different keyboard shortcuts to open a file, so check your browser settings first.

Method 3 of 3: Running an HTML file for a website

Run a HTML File Step 9

Step 1. Open your preferred FTP environment

If your host has a built-in FTP function, use it-it makes things a lot easier. If not, use a separate FTP program, such as FileZilla.

Run a HTML File Step 10

Step 2. Next, connect to your remote server (your website's server)

If you use the built-in environment, you don't have to worry about this. You will be presented with two boxes, both left and right. First, focus only on the bottom right box, not the other boxes.

Run a HTML File Step 11

Step 3. Locate your HTML file and drag it into the box

It will be uploaded right away. If you are using the built-in environment, locate the "htdocs" folder (or the default HTML folder) and click "Upload"; then you will see more options.

Don't use the shortcut! With that you upload the LNK Mirror file and that is not the intention

Run a HTML File Step 12

Step 4. Wait for the file to be uploaded

Then, once you've removed the default page, you can go to your website to view the HTML file! If you see a list of files, click the.html file to view it.

Popular by topic