nerdexam
Microsoft

98-375 · Question #106

You have a Hypertext Markup Language (HTML) p element that is too narrow for the intended layout. It has the following Cascading Style Sheet (CSS) computed style: margin: 5px; border-width: 5px…

The correct answer is A. margin C. border-width. The CSS box model defines the total layout width as the width of the left margin plus the width of the left border plus the width of the content plus the width of the right border plus the width of the In this example, the total width of the paragraph is 5 + 5 + 470 + 5 + 5 =…

Understanding CSS3

Question

You have a Hypertext Markup Language (HTML) p element that is too narrow for the intended layout. It has the following Cascading Style Sheet (CSS) computed style:

margin: 5px; border-width: 5px; padding: 20px; outline-width: 5px; width: 470px; Which two CSS properties can you set to 10px so that the total box model width of the paragraph will equal 500px? (Each correct answer presents a complete solution. Choose two.)

Options

  • Amargin
  • Boutline-width
  • Cborder-width
  • Dpadding

How the community answered

(28 responses)
  • A
    86% (24)
  • B
    7% (2)
  • D
    7% (2)

Explanation

The CSS box model defines the total layout width as the width of the left margin plus the width of the left border plus the width of the content plus the width of the right border plus the width of the In this example, the total width of the paragraph is 5 + 5 + 470 + 5 + 5 = 490 pixels. By adding 5 pixels to both sides, the total width will increase to 500 pixels as desired. You could set the margin CSS property to 10px to add 5 pixels to the left and right sides. This would result in a total width of 10 + 5 + 470 + 5 + 10 = 500 pixels. You could set the border-width CSS property to 10px to add 5 pixels to the left and right sides. This would result in a total width of 5 + 10 + 470 + 10 + 5 = 500 pixels. You should not set the padding CSS property to 10px. The padding property defines how much whitespace is left between the content and the interior boundary of the border. In this example, the width property has been used to define the total interior width - the padding property will not affect this measurement. The only effect setting padding to 10px would have is to make the content fit closer to the border. You should not set the outline-width CSS property to 10px. The outline of an element is similar to a border and uses similar CSS properties. The most important difference is that an element's outline does not affect the overall box model dimensions of the element. Setting the outline-width to 10px would draw a thicker border that overflows the margin of this element.

Topics

#box model#margin#border-width#width calculation

Community Discussion

No community discussion yet for this question.

Full 98-375 Practice