← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 484 · 40 questions
TalentJR

Code tip (Rule, then maths): Find the topic: syntax, selectors, properties, colours, box model, cascade, flexbox or media queries. Decide which rule or property applies to the element. For sizes, write the sum down: both sides for the box model, free space for flexbox.

NameDateTime takenScore ___ / 40
  1. 1.📱 min-width: 800px applies when the screen is ___. (a) exactly 100px (b) 800px or narrower (c) turned off (d) 800px or wider
  2. 2.✍️ Which property is set to italic in this rule?
    p {
      background-color: yellow;
      padding: 8px;
      font-style: italic;
    }
    (a) font-size (b) font-style (c) color (d) italic
  3. 3.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      font-weight: bold;
    }
  4. 4.Which of these is padding? (a) space outside the border (b) a solid or dotted edge (c) space inside the border (d) the text or picture
  5. 5.🎯 What kind of selector is #hero? (a) an element selector (b) an id selector (c) a class selector
  6. 6.⚖️ What colour is the text of this element?
    <h1 class="box" id="hero">Hi</h1>
    CSS:
    h1 { color: red; }
    h1 { color: blue; }
    (a) red (b) blue (c) black (d) white
  7. 7.🎯 What kind of selector is .menu? (a) a class selector (b) an element selector (c) an id selector
  8. 8.🎯 Which element does the selector #logo style? (a) <h1 id="logo"> (b) <h1 class="logo"> (c) <h1 id="end"> (d) <h2 class="big">
  9. 9.🌈 In #006100 the green part is the hex number 61. What is it as a normal number?
  10. 10.True or false: margin is space outside the border. (a) False (b) True
  11. 11.🔍 Which is the odd one out? (a) makes headings and lists (b) changes the page live (c) reacts to a button click (d) checks a quiz answer
  12. 12.🎨 Which tag connects an outside CSS file? (a) <a> (b) <link> (c) <img> (d) <css>
  13. 13.🌈 Which hex code is magenta? (a) #00ffff (b) #ff0000 (c) #000000 (d) #ff00ff
  14. 14.🎯 Which element does the selector .star style? (a) <p class="menu"> (b) <p id="star"> (c) <h1 class="note"> (d) <p class="star">
  15. 15.🎯 Which element does the selector h2 style? (a) <span id="top"> (b) <li> (c) <div class="red"> (d) <h2 class="red">
  16. 16.True or false: .big is an element selector. (a) False (b) True
  17. 17.Which of these does CSS do? (a) adds space around boxes (b) puts a picture on a page (c) makes a link (d) makes headings and lists
  18. 18.✍️ Which property is set to yellow in this rule?
    body {
      background-color: yellow;
      font-style: italic;
    }
    (a) background-color (b) padding (c) yellow (d) margin
  19. 19.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) neither (c) the later one (d) the first one
  20. 20.⚖️ What colour is the text of this element?
    <h1 class="note" id="main">Hi</h1>
    CSS:
    h1 { color: orange; }
    .note { color: blue; }
    #main { color: red; }
    (a) blue (b) orange (c) purple (d) red
  21. 21.⚖️ What colour is the text of this element?
    <p class="star" id="end">Hi</p>
    CSS:
    .star { color: white; }
    #end { color: orange; }
    (a) blue (b) purple (c) orange (d) white
  22. 22.🎯 Which element does the selector .menu style? (a) <h2 id="menu"> (b) <li class="big"> (c) <h2 class="note"> (d) <h2 class="menu">
  23. 23.What does font-weight do? (a) sets the letter colour (b) centres a heading (c) makes the text bold (d) colours behind the text
  24. 24.🧩 Which language reacts to a button click? (a) HTML (b) CSS (c) JavaScript
  25. 25.⚖️ What colour is the text of this element?
    <h2 class="box" id="logo">Hi</h2>
    CSS:
    h2 { color: orange; }
    .box { color: blue; }
    (a) blue (b) purple (c) yellow (d) orange
  26. 26.⚖️ What colour is the text of this element?
    <h1 class="note" id="logo">Hi</h1>
    CSS:
    h1 { color: white; }
    #logo { color: black; }
    (a) green (b) white (c) black (d) blue
  27. 27.📦 In the box model, which part is the gap round content? (a) border (b) content (c) padding (d) margin
  28. 28.What does text-align do? (a) picks the font style (b) centres a heading (c) makes letters bigger (d) sets the letter colour
  29. 29.🖌️ How big is the text, in px?
    h1 {
      color: black;
      background-color: yellow;
      text-align: right;
      font-size: 16px;
    }
  30. 30.🌈 In #rrggbb, which colour do the first two digits give? (a) green (b) black (c) blue (d) red
  31. 31.✍️ Which sign goes between a property and its value? (a) = (b) ; (c) - (d) :
  32. 32.⚖️ Which selector is the strongest? (a) an id selector (b) an element selector (c) a class selector
  33. 33.🎯 Which element does the selector #end style? (a) <li class="big"> (b) <h2 id="end"> (c) <h2 class="end"> (d) <h2 id="hero">
  34. 34.True or false: JavaScript reacts to a button click. (a) True (b) False
  35. 35.✍️ In color: blue; which part is the property? (a) : (b) color (c) blue (d) ;
  36. 36.True or false: CSS shows a pop-up message. (a) True (b) False
  37. 37.✍️ What value is given to background-color in this rule?
    p {
      width: 300px;
      padding: 8px;
      background-color: yellow;
      text-align: center;
    }
    (a) background-color (b) 10px (c) 8px (d) yellow
  38. 38.What does font-size do? (a) colours behind the text (b) makes letters bigger (c) picks the font style (d) sets the letter colour
  39. 39.✍️ What is the selector in this CSS rule?
    p {
      font-weight: bold;
      margin: 10px;
    }
    (a) p (b) font-weight (c) 10px (d) .note
  40. 40.✍️ What is the selector in this CSS rule?
    p {
      font-weight: bold;
      text-align: center;
      font-size: 20px;
      margin: 10px;
    }
    (a) p (b) center (c) font-weight (d) .note

Answer key

  1. 800px or wider
  2. font-style
  3. 1
  4. space inside the border
  5. an id selector
  6. blue
  7. a class selector
  8. <h1 id="logo">
  9. 97
  10. True
  11. makes headings and lists
  12. <link>
  13. #ff00ff
  14. <p class="star">
  15. <h2 class="red">
  16. False
  17. adds space around boxes
  18. background-color
  19. the later one
  20. red
  21. orange
  22. <h2 class="menu">
  23. makes the text bold
  24. JavaScript
  25. blue
  26. black
  27. padding
  28. centres a heading
  29. 16
  30. red
  31. :
  32. an id selector
  33. <h2 id="end">
  34. True
  35. color
  36. False
  37. yellow
  38. makes letters bigger
  39. p
  40. p

Free html and css lessons, practice and worksheets at talentjr.in/html-css-for-kids