-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Mastering CSS
By :

Let's search for some other non-percentage-based widths/margins/paddings. So we're not worried about anything related to vertical distance, like height
, margin-top
, margin-bottom
, padding-top
or padding-bottom
. And we're not worried about any value of 0
.
We will come acrossauto
for the left and right margin in the wrapper
rule set:
.wrapper {
max-width: 960px;
width: 90%;
margin: 0 auto;
}
This doesn't need to be converted into a percentage because auto
automatically calculates the width based on the space available, so it's as good as a percentage.
We are worried about this margin
property in the following declaration block:
.content-block .figure {
float: left;
margin: 30px;
border: 15px solid #fff;
overflow: hidden;
}
This rule set has a margin
of 30px
; it's using the single value syntax. This means the top, bottom, left, and right margins are all 30px
. We only want to change the left and right margins. So what we can do is use the two-value...