Coders' Guidebook

How to add new webpages and links to your website

Making new webpages for your site is very similar to how you created your first HTML file. You can likely copy over much of the existing code from the original HTML file to the new one (e.g. the parts of the head and body elements that will be used on every webpage). Bear in mind though that some details may need to be modified slightly. For example, the 'title' declaration in the head element will likely need updating (e.g. change it from 'Home' to the name of the new webpage).

When it comes to saving the new webpage you have two main options. First, you could create a subfolder with the name of the webpage (e.g. About) then save the new HTML file within that subfolder as 'index.html'. Alternatively, you could save the new HTML file within the main folder for your website but you must use a different filename than 'index.html'. This is because in the main folder of your website the filename 'index.html' is already taken by the homepage. Instead, choose a file name that gives a good description of the webpage's content (e.g. 'about.html', 'contact.html', 'rare-tree-species.html'). It is worth remembering if you opt to save your new HTML file in a subfolder that your link to the 'main.css' stylesheet will need to be changed from <link rel="stylesheet" type="text/css" href="main.css"> to <link rel="stylesheet" type="text/css" href="../main.css">. Adding '../' before a file name tells the web browser that the file is located in a parent folder.

<<< Previous

Next >>>