Chapter 6 Box Properties
Download file with answers
Chapter 6- Box Properties
1 file(s) 289.30 KBNot a member!
Create a FREE account here to get access and download this file with answers
Chapter 6: Box Properties
TRUE/FALSE
1. Block elements can contain other block elements or inline boxes that contain the element content.
2. Inline-level elements form new blocks of content.
3. Parent elements contain child elements.
4. CSS lets you specify margin, border, and padding values for all block-level elements.
5. Margins are always transparent, showing the background of their containing element.
6. Increasing the margins does not enhance the legibility of text.
7. When the browser collapses the vertical margins between elements, the browser adds the value of the top element’s bottom margin and the bottom element’s top margin.
8. The border-style property must be stated to make a border appear.
9. Percentages are not allowed when using the border-width property.
10. The default border color is the color of the element content.
MULTIPLE CHOICE
1. The CSS ____ model describes how the element content boxes should be displayed by the browser.
a. visual formatting c. box formatting
b. box d. visual box formatting
2. In HTML, elements fall into ____ primary box types.
a. two c. four
b. three d. five
3. ____ elements appear as blocks such as paragraphs.
a. Inline-level c. List-item
b. Page-level d. Block-level
4. Theelement is the ____ for the elements of a Web page.
a. content box c. containing box
b. container d. containing block
5. The CSS ____ model describes the rectangular boxes that contain content on a Web page.
a. visual formatting c. box formatting
b. box d. visual box formatting
6. You can set ____ margin values to achieve special effects.
a. zero c. negative
b. positive d. individual
7. The ____ margins are the top and bottom element margins.
a. spatial c. horizontal
b. vertical d. main
8. If the paragraph element’s margin-top value is 15px and margin-bottom value is 25px, the browser sets the vertical margin between paragraphs to ____ pixels.
a. 10 c. 25
b. 15 d. 40
9. The ____ is between the element content and the border.
a. unused area c. margin
b. padding area d. dead space
10. The padding area inherits the ____ of the element.
a. foreground color c. background color
b. margin area d. margin color
11. The ____ is the most important border property.
a. border-color c. border-width
b. border-characteristics d. border-style
12. The ____ border-style keyword creates a three-dimensional border that appears to be engraved into the page.
a. groove c. ridge
b. double d. inset
13. The ____ border-style keyword creates a three-dimensional border that appears to be embossed.
a. groove c. ridge
b. double d. inset
14. The ____ border-style keyword creates a three-dimensional border that appears to set the entire box into the page.
a. groove c. ridge
b. outset d. inset
15. If you specify a border style that is not supported, the border defaults to ____.
a. solid c. dashed
b. double d. none
16. With the example “p {border-style: solid double dashed dotted;}”, the bottom border of a
element will be ____.
a. solid c. dashed
b. double d. dotted
17. The ____ property lets you state the width of the border with either a keyword or a length value.
a. border-color c. border-height
b. border-width d. border-style
18. The value of the border-color property can be either a hexadecimal value, RGB value, or one of the ____ predefined color names.
a. 8 c. 16
b. 12 d. 24
19. Which of the following is a predefined color name?
a. Cyan c. Purple
b. Magenta d. Orange
Using the example “p {border-color: black red green;}”, the bottom border of a
element will be ____.
a. black c. green
b. red d. transparent
21. Which of the following properties lets you state the properties for all four borders of an element?
a. border-overall c. border
b. border-style d. border-width
22. When calculating box model width, the ____ and ____ properties let you determine exactly how wide or narrow you want the width of a box to be.
a. margin, padding c. width, height
b. min-width, max-width d. border, padding
23. The ____ property lets you position an element to the left or right edge of its parent element.
a. width c. height
b. clear d. float
24. The ____ property lets you control the flow of text around floated elements.
a. clear c. text
b. float d. flow
25. The ____ property lets you add box shadows to an element to create a 3D effect.
a. shadow c. box-shadow
b. drop-shadow d. inset
COMPLETION
1. The visual formatting model is based on the ____________________ structure of the HTML document and the element display type.
ANS: hierarchical
PTS: 1 REF: 245
2. The CSS ____________________ property determines how the browser displays an element.
ANS: display
PTS: 1 REF: 247
3. ____________________ values for padding and margins are often specified in fixed page designs where the dimensions of the layout are consistent.
ANS: Pixel
PTS: 1 REF: 251
4. Always use ____________________ measurement values, such as ems or percentages, if you want your Web pages to adapt to different browser sizes or user-applied font size..
ANS: relative
PTS: 1 REF: 251
5. To ensure that the spacing between block-level elements is consistent, the browser ____________________ the vertical margins between elements.
ANS: collapses
PTS: 1 REF: 254
6. You can set margin values to ____________________ if you want to remove the default margin spacing that is built into the browser.
ANS: zero
PTS: 1 REF: 254
7. The ____________________ area is between the element content and the border.
ANS: padding
PTS: 1 REF: 255
8. The CSS 3 ____________________ property lets you create rounded borders on block-level elements.
ANS: border-radius
PTS: 1 REF: 267
9. The ____________________ box properties let you control the dimensions and position of content boxes.
ANS: page layout
PTS: 1 REF: 268
10. The ____________________ property lets you set the vertical height of an element.
ANS: height
PTS: 1 REF: 272
ESSAY
1. What is the CSS visual formatting model and what are the display type categories included in this model?
ANS:
The CSS visual formatting model describes how the element content boxes should be displayed by the browser, for example, whether scroll bars appear and how text is wrapped based on the browser window size. The visual formatting model is based on the hierarchical structure of the HTML document and the element display type. In HTML, elements fall into two primary box types:
Block: Block-level boxes appear as blocks such as paragraphs. Block elements can contain other block elements or inline boxes that contain the element content.
Inline: Inline-level boxes contain the content within the block-level elements. They do not form new blocks of content.
PTS: 1 REF: 245
2. What is the CSS box model?
ANS:
CSS box model describes the rectangular boxes that contain content on a Web page. Each block-level element you create is displayed in the browser window as a box with content. Each content box can have margins, borders, and padding.
The content box is the innermost box, surrounded by the padding, border, and margin areas. The padding area has the same background color as the content element, but the margin area is always transparent. The border separates the padding and margin areas.
PTS: 1 REF: 248
3. Briefly describe border properties. What are the available border styles?
ANS:
The border properties let you control the appearance of borders around elements. The border area resides between the margin and padding. Border properties for each border side let you specify the style, width, and color of each border. You will likely use the five border shorthand properties, which include:
border
border-left
border-right
border-top
border-bottom
These shorthand properties let you state border style, border color, and border width for all four borders or for any of the individual sides of the box. However, you can also state much more specific borders by using the border properties separately.
The border style is the most important border property because it must be stated to make a border appear. The border-style property lets you choose from one of the following border-style keywords:
none: No border on the element; this is the default setting
dotted: Dotted border
dashed: Dashed border
solid: Solid line border
double: Double line border
dot-dash: Alternating dots and dashes (CSS3 value)
dot-dot-dash: Two dots and a dash (CSS3 value)
wavy: Wavy line border (CSS3 value)
groove: Three-dimensional border that appears to be engraved into the page
ridge: Three-dimensional border that appears to embossed (or extend outward from the page)
inset: Three-dimensional border that appears to set the entire box into the page
outset: Three-dimensional border that appears to extend the entire box outward from the page
The following code shows an example of the border-style property in use:
p {border-style: solid;}
Each browser displays the border styles differently. If a border you specify is not supported, the border defaults to solid.
PTS: 1 REF: 258-259
4. Describe the width and height page layout box properties.
ANS:
The page layout box properties let you control the dimensions and position of content boxes. There properties are essential to building CSS page layouts. Using these box properties, you can specify the exact shape of a content box and create columns and boxes of content. You can set minimum and maximum heights as well as control how your boxes are resized based on the size of the browser window. You can also align boxes to the left or right of other elements using the float property and allow text to wrap around images.
Width: The width property lets you set the horizontal width of an element using either a length value or a percentage. The percentage value is based on the width of the containing element box. The following is an example of width property usage:
div {width: 200px;}
If you use percentages, the content boxes will adapt to the size of the browser or the containing element, allowing you to build flexible page layouts based on the browser size. If you are building fixed dimension layouts, use pixel values for width.
Height: The height property lets you set the vertical height of an element. Height should only be used in situations where you know the exact height of the element content, such as an image. At other times, you may need to create a box with specific dimensions for a design. It is a better practice to let the content determine the height of the element.
The height property accepts either a length value or a percentage. The percentage value is based on the height of the containing element box. The following is an example of height property usage:
div {height: 150px;}
PTS: 1 REF: 268-269 | 272
5. Describe the float, clear, and overflow properties.
ANS:
Float: The float property lets you position an element to the left or right edge of its parent element. You can float an image to the left or right of text.
The style rule for the floating image floats the image to the left and adds a margin to offset the text from the image. The style rule looks like this:
img {
float: left;
margin-right:10px;
}
The float property can also be used to float a content box to the left or right of text. Used with the width element, you can create a content box.
Clear: The clear property lets you control the flow of text around floated elements. You only use the clear property when you are using the float property. Use the clear property to force text to appear beneath a floated element, rather than next to it.
The clear property lets you clear from either left- or right-floating images using the left or right values. The both value lets you control text flow if you have floating images on both the left and right sides of the text.
Overflow: The overflow property lets you control when content overflows the content box that contains it. This can happen when the content is larger than the area it is designed for, especially when a height property is set for a content element.
To solve this problem, you can add an overflow property to the element. You can choose to show scroll bars or to hide the overflow content.
PTS: 1 REF: 272-273 | 275-277
Leave a reply