2. Color
• Computers create the colors you see on a
monitor by combining three colors: red,
green, and blue
• You can create a recipe for a color by telling
the computer how much of the three to mix in
5. Every element in a document, both
block-level and inline, generates a
rectangular element box
6.
7. Content Dimensions
• Width and height properties to specify the
width and height of the content area of the
element
• Can specify the width and height only of
block-level elements and non-text inline
elements such as images
8. Specifying Height
• Less common to specify the height of
elements
• Overflow property lets you specify what to do
with text that doesn’t fit
14. Padding Shorthand
• 1 value : padding: 10px;
– Applied to all sides.
• 2 values : padding: 10px 6px;
– First is top and bottom;
– Second is left and right.
• 3 values : padding: 10px 6px 4px;
– First is top;
– Second is left and right;
– Third is bottom.
• 4 values : padding: 10px 6px 4px 10px;
– Applied clockwise to top, right, bottom, and left edges
consecutively
– (TRBL).
19. Specifying Border Color
• Property: border-color
• More Properties: border-top-color, border-
right-color, border-bottom-color, border-left-
color
20. Specifying Border
• You can provide style, width, and color values
in one declaration
p {
border: 1px dashed #F26521;
}
21. Specifying Border
• Can also use: border-top, border-right,
border-bottom, border-left
• Values for properties may include style, width,
and color values in any order.
• If the border style value is omitted, no border
will show.
23. Specifying Margin
• Similar to padding
• margin-top, margin-right, margin-bottom,
margin-left
• Same short hands as padding apply
24. Margins
• The top and bottom margins of neighboring
elements collapse.
• Instead of accumulating, adjacent margins
overlap, and only the largest value will be
used
25. Margins
• Only horizontal margins are rendered on
inline text elements
• For non-text inline elements, margins
rendered on all sides.