untitled

(John Hannent) #1
An element’s height and the top and bottom margin properties can be set to
auto. If you want to specify the padding property (to add space between the
content and any border), or the border width itself, you must specify those
with actual units of measurement, or percentages, but not auto. However,
auto, for margin tops and bottoms, defaults to zero.

Horizontal Positioning ................................................................................


Western browsers read from left to right, so when elements are positioned
horizontally, they start on the left side. But you must always remember that
its box can be larger than the element’s contents.

Consider this example that displays a background color to illustrate the
widthproperty of this paragraph element. The result is shown in Figure 9-9:

<style>

p {width: 100px;background:tan;}

</style>

</head>

<body>

<p>This paragraph is only 100px wide.</p>

</body>

Figure 9-9:
The width
here is
simply
specified
by the
paragraph
style’s
width
property.

176 Part III: Adding Artistry: Design and Composition with CSS

Free download pdf