In this tutorial, you will set up the folders and files necessary for building a website with HTML and CSS. You will also prepare an
index.html file so that it is ready to receive HTML content in the tutorials ahead.
If you have been following along with this tutorial series, you can continue using the
css-practice project directory,
css folder, and
styles.css file that you created earlier in the series. If you have not been following along this tutorial series and need instructions for setting up these folders and files, please see our earlier tutorial in this series How To Set Up Your CSS and HTML Practice Project.
Note: If you decide to create your own names for the folders or files, make sure to avoid character spaces, special characters (such as !, #, %, or others), and capital letters, as these can cause problems later on. Be aware also that you will need to modify your file paths in some of the steps throughout the remainder of this tutorial series to ensure that they correspond with the names of your files.
You should have a project folder named
css-practice that contains the following folders and files that are necessary to explore CSS in this tutorial series:
cssthat contains the file
In the first step of this tutorial, you will prepare the
index.html file so that it is ready to receive content in the tutorials ahead.
To prepare your
index.html file to serve as your website’s homepage, we’ll need to add a few important lines of HTML. These lines of HTML will serve as instructions for the browser and will not be displayed on the webpage itself. Make sure that your
index.html file is empty (if you have content from previous tutorials) and add the following code snippet to the document:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Sammy the Shark</title> <link rel="stylesheet" href="css/styles.css"> </head> <body> </body> </html>
Make sure to change the highlighted site title with a title of your own choosing. Then save the
index.html file. Before continuing, let’s briefly review the code that you just added to understand its purpose:
<!DOCTYPE html>declaration tells the browser which type of HTML is being used in this document. It is important to declare this value as there are multiple versions of the HTML standard, and browsers need to know which to use. In this declaration,
htmlspecifies the current web standard of HTML, which is HTML5.
<html>tags tell the browser that all content inserted between these two tags should be interpreted as HTML. Inside this tag, you also added the
langattribute, which specifies the language of the webpage. In this example, the language is set to English using the
enlanguage tag. For a full list of language tags, visit the IANA Language Subtag Registry.
<head>tags creates a section in the HTML document that typically contains information about the page, rather than page content itself. Browsers do not display the information in a
<meta charset="utf-8">tag specifies the document’s character set should be UTF-8, a unicode format that supports a majority of characters from a wide variety of written languages.
<title>tag tells the browser the name of the webpage. This title appears on the browser tab and when the site is listed in search results but it does not show up on the web page itself. Make sure to replace “Sammy the Shark” with your name or a title of your choosing if you want to personalize the site.
<link rel="stylesheet" href="css/styles.css">tells the browser where to find the stylesheet that contains the style rules. If you followed the instructions earlier in this series How To Set Up Your CSS and HTML Practice Project, your stylesheet should be located at this file path.
<body>tags will contain the main content of the webpage. You’ll add the HTML content between these tags in the tutorials ahead.
You have now created all of the folders and files necessary for creating a website with HTML and CSS. You should also have an
index.html file prepared with the necessary HTML content for serving as your website’s homepage. In the next tutorial, you’ll explore how the demonstration site is constructed and the steps you will take to recreate it.
Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.
This tutorial is part of a series on creating and customizing this website with CSS, a stylesheet language used to control the presentation of websites. You may follow the entire series to recreate the demonstration website and gain familiarity with CSS or use the methods described here for other CSS website projects.
Before proceeding, we recommend that you have some knowledge of HTML, the standard markup language used to display documents in a web browser. If you don’t have familiarity with HTML, you can follow the first ten tutorials of our series How To Build a Website With HTML before starting this series.