157
CHAPTER
Laying Out Pages 6
TIP
Why do I need to add a margin to the nonfloated element?
Floated elements are removed from the flow of the page; that is, other elements on the page may act as if
the floated element was not where it is. Text correctly wraps around floated elements, but background
colors and borders do not. Therefore, you need to add enough margin to the nonfloated element to force it
out of the floated element’s way.
● When you view the HTML
page in a browser, the
problems created by the
float are fixed.
3 In the declaration for
the other element, add
margin-left:”?” or
margin-right:”?” to
create space between the
elements. Replace? with an
appropriate value for the
margin, which needs to be at
least the width of the floated
element.