1D0-510 · Question #62
Maria wants to use Cascading Style Sheets (CSS) to apply formatting styles to her Web pages. In her style sheet, she sets the page's background color to blue and the font to Arial. Which style rule…
The correct answer is C. body {background: blue; font-family: arial;}. See the full explanation below for the reasoning.
Question
Options
- Abody {bgcolor: blue; font-type: arial}
- Bstyle-body {background: blue; font: arial}
- Cbody {background: blue; font-family: arial;}
- D<style>body {bgcolor: blue; font-family: arial}>
How the community answered
(46 responses)- A2% (1)
- B11% (5)
- C80% (37)
- D7% (3)
Community Discussion
6C is the one, and the reasoning clicks fast once you know the actual CSS property names. The property for background color is "background" or "background-color", not "bgcolor" (that is an old HTML attribute, not CSS), and the property for specifying a typeface is "font-family", not "font-type" or "font". Option A gets both property names wrong, B invents a fake selector called "style-body" that means nothing in CSS, and D wraps the rule in an HTML style tag, which has no place inside an external stylesheet file. External stylesheets are pure CSS syntax, no HTML tags, so D is out immediately on that alone. C gives you a valid selector (body), correct property names, and proper semicolon-separated declarations inside curly braces, which is exactly how CSS is supposed to look.
Kept second-guessing A until I remembered bgcolor is HTML, not CSS, so C.
I kept eyeing A thinking bgcolor sounded right, but bgcolor is HTML not CSS, so C it is.
bgcolor being an HTML attribute was deprecated even before CSS took over the conversation, so C is right, but knowing *why* bgcolor died, which is separation of concerns, is what saves you when the question gets twisted.
A uses bgcolor and font-type, which is what HTML attributes taught us, so the logic carries over.
Viktor, bgcolor and font-type are not valid HTML attributes either, so that logic does not carry over. The correct answer is C because the valid HTML attributes for those purposes are bgcolor and face, as used on the font and body elements in older HTML.