Using Margins
Margins are commonly styled to control the space between elements. You'll have noticed that there's always a certain amount of space, by default, around content displayed in web browsers (visible in Figure 11-1). This can be controlled by changing the margin values in the body element (see Example 11-1).
Example 11-1. Setting margin values for the body element
body {font: 14px Verdana, Arial, Helvetica, sans-serif; color: white; background-color: black; margin-top: 0; margin-left: 0; border: 2px solid white;}h1 {font-size: 24px; color: orange;}h2 {font: italic 20px Georgia, Times, serif; color: #999; text-indent: 15px;}
NOTE
You'll see that I have no length value such as px
or em
after my 0
. That's because a 0
value requires ...
Get Spring Into HTML and CSS now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.