Web Design

(Nancy Kaufman) #1

155


CHAPTER

Laying Out Pages 6


TIPS


Do I have to set a width?
Yes. By default, elements have a width of 100%,
which does not leave any room for the elements
that follow to float. Therefore, you must set a width
on every element you want to float. You generally
also set widths on the elements that follow the
floated element to better control them.

Can I stop sections such as footers from floating?
Yes. You can create a style for your footer and add
the CSS clear:all property, which tells the
browser that that section should not float. You can
also set clear to left or right to have it
ignore a float on that particular side.

● When you view the page
in your browser, the content
that follows the element
you floated appears either
to the right or the left of it,
depending on the value you
chose in Step 7. The layout
may not look correct yet.

5 Type width:?;, replacing?
with the size of the element.
Be sure to include a unit of
measurement such as px.


6 Press.


7 Type float:?;, replacing?
with either left or right.


8 Press.


9 Type }.


5


9


7

Free download pdf