Naming Your Page
Before you name your web page, create a folder to hold all of your web pages. The folder can be anywhere ( a: drive, c: drive, flash drive), it doesn't mater. Just be sure you know where it is so you can find it again. Name the folder "website". Now you can save the text file that you just created using Notepad in the folder called "website." As you save the text file, name it "first.html".
The home page, or main page, of a website is typically named index.html. That is so the server hosting the website will serve the page up automatically. For example, a link to http://www.nvcc.edu will serve up (show the user) the page named index.html in the root directory: http://www.nvcc.edu/index.html.
Naming a web page correctly is easy if you follow these three rules:
- No spaces
- No capitals
- The file extension is .html (that's dot html)
If you want to know the why behind these rules, read on.
Spaces in filenames can confuse browsers and email programs. Browsers usually substitute "%20" for a space. Email programs sometimes cut off URLs after a space. If you want to use a space for clarity, use a hyphen instead. For example, "onion recipe.html" becomes "onion-recipe.html"
Capitals matter. You're probably creating your first web page in a Windows operating system environment. If so, Windows is pretty lax about file names. But once you're done creating your page, and you upload it to a server (so that Aunt Tilly in Iowa can see it), the server may be using a different operating system, like Unix or Linux. Unix and Linux care about capitals. MyFile.html is a totally different file than myfile.html in a Unix or Linux environment. You can use capitals in your file names, but when you create your links (which we'll get to real soon), they won't work if your link file name doesn't match your actual file name, exactly. If you use all lowercase, you don't have to try to remember "Did I use a capital or not?"
File extensions. Extensions matter. Your web page extension must be either .htm or .html. It doesn't matter which, but you've got to be consistent. If you create a link to myfile.html and the page is named myfile.htm, the link won't work. Convention is to use .html as the extension.
Ok, now that we've saved our first web page with the name "first.html" let's take a look at it in the browser.