Styling the Document
The first thing we’ll do is change the horizontal alignment of a couple of elements—the contact information (right-aligned) and the footer (centered), like this:
<style type="text/css"> body {background: white; color: black;} div#contact-info {text-align: right;} div#footer {text-align: center;} </style>
We have included a default body rule so that we know where we’re starting: with black text on a white background. This is the most common browser default, so it’s where we’re going to start. By explicitly declaring these values, we make sure that any CSS-capable browser is going to start from the same point we did when we wrote our styles.
Alignment MythsThe property text-align can be used to center the content of block-level ... |
Get Eric Meyer on CSS: Mastering the Language of Web Design 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.