Web Design with HTML and CSS

(National Geographic (Little) Kids) #1

166


A brief history of layout techniques on the web

Web Design with HTML and CSS Digital Classroom

p, h1, h2, h3,h4 {
margin-bottom:20px;
}

Save the page and preview it in your browser. Most of your elements now have some
added space from these margins. To add a top margin to the heading 2 in your sidebar
you could add another rule as shown in the next step.
12 In your text editor, add the following rule set:
#sidebar h2 {
margin-top:15px;
}

Save the page and preview it in your browser. Your heading 2 in the sidebar has been
pushed down by the top margin.

Your sidebar with a top margin of 15 pixels applied.
Free download pdf