3.5.2 The Cascade Quiz
Question: Why do we use CSS?
Answer: -CSS allows us to add style (HTML wasn’t intended to be able to style web pages)
-separate the content of a web page from the design of a webpage
-easily modify the look and feel of a web site even at a large scale
Question: In the case that two conflicting rules have the same order and specificity, the rule that is written _____ will be applied.
Answer: last
Question: The _____ property indicates in which direction to display an element.
Answer: float
Question: It is _____ for Web developers to utilize images to call attention to a Web page.
Answer: usual
Question: Write the valid CSS rule to style all h1 tags blue.
Answer: h1{
color: blue;
}
Question: Write the code that will select all HTML elements with the class “alert” and set their color to be red.
Answer: .alert{
color: red;
}
Question: Write the CSS rule that will select the HTML element with the id logo and set the font size for that element to 60 pixels.
Answer: #logo{
font-size: 60px;
}
Question: What is the function of the Cascade in CSS?
Answer: determines which CSS rules will be applied when multiple rules for an item are contradictory
Question: In what order does the Cascade look at factors to determine which CSS rule to follow?
Answer: 1) importance
2) specificity
3) the order the rules are written in
Question: Order the following from highest precedence to lowest:
class name, tag name, id name
Answer: id name, class name, tag name