HTML5, CSS3, and JavaScript Fourth Edition

(Ben Green) #1

CHAPTER 12. BOX MODEL 133


Required Answer:9px


Exam Question 235(p.350):When we say margin: 9px 8px; what is the
implied fourth value?
Required Answer:8px


12.4 Measurement Units


The length measurement (size) of padding, borders, margins, and outlines
can be specified in any of several ways. This variety is in response to the
many ways web designers want to control the appearance of their webpages.


12.4.1 Percentages


Distance can be measured by percentage, in which case, by default, it is
based on the size of the central object (interior content). This is called
box-sizing: content-box.


If we specifybox-sizing: border-box, then distance percentages are based
on the size of outer border, which includes the size of the border, padding,
and content. Although this is not the default, it is a very popular alternative
to content-box sizing.


Exam Question 236(p.350): List the two “box-sizing:” options.
Required Answer:border-box, content-box


Exam Question 237(p.350): What “box-sizing:” option is the default?
Required Answer:content-box


12.4.2 Pixels


Some, likepx(pixel), are designed to be displayed on a screen. As previ-
ously stated in 1.2 (page 10), there are 47 CSS pixels in one degree of direct
vision width. Originally a pixel was one dot on the computer screen. This
was the natural measurement the computer used to render things. For many
purposes I believe it is the best measurement today.


Exam Question 238(p.350): How many CSS pixels are in one degree of
direct vision?

Free download pdf