File Names

File names should include no whitespace. Use only letters and numbers. You can replace spaces with an underscore ( _ ) or you can use camelCase toIndicate whereNewWordsStart.

Give your files descriptive names*.

For example, instead of "Untitled.jpg" or "Screenshot 2027-11-11 at 11.11.11 AM.png", use "happyCow.jpg" or "happy_cow_1.png"

Photo of a cow smiling at the camera Photo of a cow smiling at the camera

"index.html"

*While you should give most files descriptive names, the landing page for your website should always be named index.html. This is important in our class because we are publishing webpages via GitHub, which automatically looks for an "index.html" file as the default landing page.

File Extensions

The three or four letters that follow the file name are called the file extension. The file extension tells the computer how to interpret the file.

Also pay attention to the file extensions used for image files. Generally, .png, .jpg (or .jpeg), and .svg files will appear in the browser without any issues.

File Paths

In HTML, you must refer to a file by its file path relative to the location of the HTML page from which the file is referenced. A relative file path will look for files in the folder (or "directory") where it resides, so you must also save all required files (stylesheets, images, scripts, etc.) somewhere in that directory.

This video - Understanding File Paths - gives a more complete explanation of absolute and relative file paths.

Organizing Images

If you have multiple images, is best practice to create an "images" folder inside your website directory and store all images there.

A screenshot of a file explorer for an web project that contains an index.html page and an images folder containing two images

Once you create an "images" folder, all of your image src attributes need to include the path through the folder and to the file. For example:

<img src="images/happy_cow_1.png">

It is best practice to include "alt-text" for images, which will display in place of the image if the image fails to load, and also provides a description of the image for vision-impaired users. For example:

<img src="images/happy_cow_1.png" alt="Photo of a cow smiling at the camera">