156
Use Margins and Padding to Fix Float Problems .........
2 In the declaration that
contains the float, type
padding-right:”?” if
you used float:left, or
padding-left:”?” if you
used float:right. Replace
? with an appropriate value for
the padding.
1 In your editor, open a style
sheet document linked to an
HTML document.
Note: The following steps can
also be done using an existing
embedded style sheet.
Use Margins and Padding to Fix Float Problems
C
hapter 4 discussed how you can add white space to your page by using the margin and
padding properties. When you float a section of your page, you often need to set margins and
padding on other sections in order to fix layout problems that the floats create. For example, if you
float a short sidebar to the left of a long main column, the main column will wrap back to the left
after the end of the sidebar. Applying a left margin to the column that equals or exceeds the width
of the sidebar fixes the problem.