CSS Foundation Quiz

Quiz 1 17 questions

Prerequisites for the quiz

  1. CSS Foundation Unit

Are you ready?

17 questions to solve

Instructions
  1. This quiz goes to full-screen once you press the Start button.
  2. At the end of the quiz, you are able to review all the questions that you answered wrong and see their explanations.
What does CSS stand for?
CSS stands for Cascading Style Sheets. This goes with choice (A).
How to write a single-line comment in CSS?
There is only one way to comment in CSS and that is using the pair /* */. This goes with choice (A).
CSS code can go inside the <style> tag, which can go inside <head> and <body>. True or false?
The <style> tag denotes CSS code, and can go within either <head> or <body>. Read more at CSS Get Started.
From the following choose the valid syntax to color all <p> elements red.
To select <p> all elements we'll need the tag selector p followed by the ruleset {color: red}. This goes with choice (C). For more info, please refer to CSS Basic Styling.
How can you select all <div> elements with the class first? Select all choices that fit.
For more info, please refer to CSS Selectors.
Select all <p> elements with class quote, that are the direct children of <div> elements.
div > p.quote selects all children of <div> elements that are <p> elements and of the class quote. This is exactly what the question asks for. For more info, please refer to CSS Selectors and CSS Combinators.
From the following list of selectors choose all those that involve pseudo selectors.
  1. div:hover
  2. div a:active
  3. .main #p1::before
  4. .sect input[type="text"]:focus
Choose the best explanation of the difference between pseudo classes and pseudo elements.
State the advantages of using external stylesheets in CSS.
Refer to CSS Get Started.
Which property controls the size of the text of an element?
font-size controls the size of the text of an element. Hence, the correct choice is (A).
Select the correct choice from the following to give all <p> elements the color blue and background color yellow.
Style declarations can't be separated using a , comma character - this rules out choice (A). Color names can't be quoted - this rules out choice (C). Finally, property names can't be followed by the = equals sign - this rules out choice (D). We are left with choice (B), which is the correct one.
Which of the following selectors has the highest level of precedence?
The more the number of selectors, the higher the level of precedence of the whole selector statement. Hence, the correct choice is (A). To learn more about precedence, please refer to CSS Style Precendence.
What is the specificity of the style attribute?
The style attribute has a specificity of 1000. To learn more about specificity in CSS, refer to CSS Style Precendence.
How else can we override a property's value written in the style attribute of an element, apart from writing it later in the attribute itself?
The !important keyword has the highest level of precedence in CSS, and can therefore override styles defined in the style attribute of an element.
Which delimiter represents a descendant combinator?
The space character denotes a descendant combinator. For more info, please refer to CSS Combinators.
What does the selector .deft + .capt select?
.deft + .capt selects all .capt elements that are the adjacent sibling of .deft elements. This goes with choice (C). For more info, please refer to CSS Combinators.
What does inherit do when assigned to a property?
When the value inherit is set on a property, the property's value is inherited by the ancestors of the given element.