The first thing to do when creating a new website project is to create a project directory (or folder) to store all the files that will be created in the process. For this website project, we can continue using the
html-practice project directory and
index.html file we created earlier in the tutorial series. (If you have not been following along this tutorial series and need instructions for setting up a project directory and
index.html file, please see our earlier tutorial in this series Setting Up Your HTML Project.
Note: If you decide to choose your own name for the directory, make sure to avoid character spaces, special characters (such as !, #, %, or others), and capital letters, as these can cause problems later on.
Next, we’ll format the
index.html file to serve as the website’s homepage. The first step in formatting a web document is to add the
<!DOCTYPE html> declaration to the first line. Make sure your
index.html file is clear and then add
<!DOCTYPE html>to the first line of the document.
This declaration tells the browser which type of HTML is being used and is important to declare as there are multiple versions of HTML. In this declaration,
html specifies the current web standard of HTML, which is HTML5.
Next, we’ll add the
<html> element by adding opening and closing
<html> tags. The
<html> element tells the browser that all content it contains is intended to be read as HTML. Your document should now look like this:
<!DOCTYPE html> <html> </html>
From this point forward, all content that we add to our website will be added between the opening and closing
We will begin adding content to our site in the next tutorial.