HTML5, CSS3, and JavaScript Fourth Edition

(Ben Green) #1

CHAPTER 12. BOX MODEL 128


We have already discovered that we can style the content by controlling its
color, background, and font.


You can set the width and/or height of the content by specifying one or
more width: or height: attributes. They are as follows:


width: You can specify the width of the content. If your content would
naturally be larger or smaller than this, the browser will scale or clip or pad
it to match this value.


max-width: You can specify the maximum width of the content. If your
content would naturally be larger than this, the browser will scale or clip it
down to this maximum value.


min-width: You can specify the minimum width of the content. If your
content would naturally be smaller than this, the browser will scale or pad
it up to this minimum value.


height:andmax-height:andmin-height:are defined similarly.


12.1.2 Padding


Closest to the content is the padding. It is transparent, so it uses the same
background color and background image as the central object.


Exam Question 216(p.349): Does padding share the same background
as the content?
Required Answer:yes


Exam Question 217(p.349): Can padding style be different on each of
the four sides?
Required Answer:yes


Padding has thickness but no other attribute. The thickness can be positive
or zero but cannot be negative. The thickness can be different on each of
the four sides: top, right, bottom, and left.


Exam Question 218(p.349): Can “padding:” be negative?
Required Answer:no

Free download pdf