Prev | Current Page 545 | Next

Craig Grannell

"The Essential Guide to CSS and HTML Web Design"

In many cases,
properties have specific values, which are listed in full. However, some values
are common across many properties. These are outlined in the ???Common CSS
values??? section, and in the CSS properties and values table these values are
shown in italics. The end of the section includes information on basic selectors,
pseudo-classes, pseudo-elements, CSS boilerplates, and CSS management.
The CSS box model
In CSS, every element is considered to be within its own box, and you can define the
dimensions of the content and then add padding, a border, and a margin to each edge as
required, as shown in the following image.
?© Jon Hicks (www.hicksdesign.co.uk)
Padding, borders, and margins are added to the set dimensions of the content, so the sum
of these elements is the overall space that they take up. For example, a 100-pixel-wide element
with 20 pixels of padding will take up an overall width of 140 pixels, not 100 pixels
with 20 pixels of padding within.
Note that the top and bottom margins on adjacent elements collapse. For example, if you
set the bottom margin to 50px on an element, and set a top margin of 100px on the element
below, the margin between the two elements will be 100 pixels, not 150 pixels.
THE ESSENTIAL GUIDE TO CSS AND HTML WEB DESIGN
472
Common CSS values
In addition to the values listed in the following table, a property may have a value of
inherit, whereupon it takes the same value as its parent.


Pages:
533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557