Web Design

(Nancy Kaufman) #1

121


CHAPTER

Formatting Your Pages 4


I want to move paragraphs closer together. When
I set the bottom margin, nothing happens. Why
is this?
Adjacent vertical margins collapse into one another
in CSS. Therefore, you must work with both the top
and bottom margins in order to move elements
closer to one another. In the examples above, the
top margins are zeroed-out so that the bottom
margin alone can control the spacing.

Can I eliminate the space around the edge of the
page with margins?
Yes. Browsers apply a default margin to the body.
Unfortunately, they are inconsistent as to the
amount of margin they apply, so many designers set
the margin of the body to 0 to eliminate this space
between their content and the edge of the window.
Note that because CSS has no default unit of
measurement, you must always provide one, except
when setting the value to 0.

● When viewed in a browser,
the page no longer has space
around the edges. The space
between the headings and
the paragraphs has also
changed.

6 Within the existing p
declaration, type
margin-top:0;.


7 Press.


8 Type margin-bottom: ?;,
replacing? with the desired
amount of bottom margin.


(^68)
TIPS

Free download pdf