In the previous chapter, we learned to structure the content of an HTML document and some related mental models. But the pages we created left a lot to be desired in terms of design and style.
In this chapter, we’ll attempt to alleviate some of these issues and learn to change the way an HTML document is displayed using Cascading Style Sheets (CSS). As mentioned in the previous chapter, this will give you enough information to get started with CSS, and More Practice and Further Reading will encourage you to explore other resources.
To get our feet wet, we’ll start with a very simple HTML example, similar to the ones from the beginning of the previous chapter. Open up a terminal window and create a directory called Chapter3 in our Projects directory.
Now open up Sublime Text, and open the Chapter3 directory in the same way that we did in the previous chapter. Create the following HTML file and save it in the directory as index.html:
<title>My First Web App
<p>This is a paragraph.
This file defines a very simple HTML page with an
h1 element and a
p element contained in the
body element. You’ll immediately notice that the example also includes a new tag contained inside the
<head> tag. The
<link> tag links to an external stylesheet file that describes how the document should be displayed.
You can create the ...