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. This tutorial will walk you through the steps of setting up folders and files necessary for building your website with HTML.
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. Inside this tag, we will also add the
lang attribute, which specifies the language of the webpage. In this example, we will specify that our site is in English using the
en language tag. For a full list of language tags, visit the IANA Language Subtag Registry.
Your document should now look like this:
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.
Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.
This tutorial series will guide you through creating and further customizing this website using HTML, the standard markup language used to display documents in a web browser. No prior coding experience is necessary but we recommend you start at the beginning of the series if you wish to recreate the demonstration website.
Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.