HTML and CSS Reference
In-Depth Information
The
overflow
property defines what is done if the content in a box is too
big for its defined space. The possible values for the
overflow
property
are as follows:
■
visible
: Shows the content outside of the box (default)
■
hidden
: Clips the content and hides what falls outside the dimensions
of the box
■
scroll
: Clips the content and always draws scrollbars to allow for
access to additional content
■
auto
: Clips the content and draws scrollbars only when they are needed
The overflow behavior for the width and the height of a box can be indi-
vidually set with the
overflow-x
and
overflow-y
properties.
note
By default, Internet Explorer will not let the content flow out of the
box but instead expand the box to fit the content as if
width
or
height
were
min-width
or
min-height
. This is partly why a short height is used in the
hasLayout
fixes discussed in Chapter 2.
When designing flexible layouts or taking multiple types of devices into
account, it can be useful to place restrictions on the size of elements. As
you will see in Chapter 7, these properties are most useful when paired
with width or height settings of
auto
or a different type of length unit.
article {
width: 100%; /* let element fit parent */
min-width
: 200px; /* ensure content isn't too narrow */
max-width
: 900px /* ensure content isn't too wide */
}