← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 432 · 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.True or false: li is a class selector. (a) False (b) True
  2. 2.🖌️ How big is the text, in px?
    p {
      color: purple;
      font-size: 12px;
      text-align: left;
      background-color: white;
    }
  3. 3.🧩 Which language changes the text size? (a) HTML (b) JavaScript (c) CSS
  4. 4.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 180px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  5. 5.📱 min-width: 800px applies when the screen is ___. (a) turned off (b) 800px or wider (c) exactly 100px (d) 800px or narrower
  6. 6.🌈 In #rrggbb, which colour do the last two digits give? (a) white (b) green (c) red (d) blue
  7. 7.🔍 Which is the odd one out? (a) makes a link (b) reacts to a button click (c) changes the page live (d) shows a pop-up message
  8. 8.🖌️ Which CSS property makes the text bold? (a) text-align (b) color (c) background-color (d) font-weight
  9. 9.✍️ Which property is set to italic in this rule?
    p {
      font-style: italic;
      border: 2px solid;
      width: 300px;
    }
    (a) font-size (b) color (c) italic (d) font-style
  10. 10.🖌️ Which CSS property makes letters bigger? (a) text-align (b) color (c) font-size (d) font-family
  11. 11.🌈 Which colour is rgb(0, 0, 255)? (a) red (b) magenta (c) blue (d) yellow
  12. 12.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 20px;
      }
    }
    (a) No (b) Yes
  13. 13.Which of these does CSS do? (a) puts a picture on a page (b) checks a quiz answer (c) adds space around boxes (d) changes the page live
  14. 14.Which of these does CSS do? (a) checks a quiz answer (b) gives the page structure (c) lays out the page (d) shows a pop-up message
  15. 15.🖌️ How big is the text, in px?
    p {
      text-align: right;
      background-color: green;
      font-size: 20px;
      color: yellow;
    }
  16. 16.🧩 Which language reacts to a button click? (a) JavaScript (b) CSS (c) HTML
  17. 17.⚖️ What colour is the text of this element?
    <p class="star" id="hero">Hi</p>
    CSS:
    .star { color: green; }
    .star { color: orange; }
    (a) red (b) orange (c) yellow (d) green
  18. 18.🔍 Which is the odd one out? (a) reacts to a button click (b) makes a form box (c) gives the page structure (d) puts a picture on a page
  19. 19.✍️ Which property is set to 2px solid in this rule?
    h2 {
      font-style: italic;
      border: 2px solid;
      margin: 10px;
    }
    (a) 2px solid (b) width (c) border (d) font-style
  20. 20.🖌️ What colour is behind the letters?
    h1 {
      color: black;
      background-color: blue;
      font-size: 36px;
      text-align: center;
    }
    (a) blue (b) white (c) black
  21. 21.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 270px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  22. 22.🌈 In #009f00 the green part is the hex number 9f. What is it as a normal number?
  23. 23.🔍 Which is the odd one out? (a) gives the page structure (b) shows a pop-up message (c) makes headings and lists (d) makes a form box
  24. 24.🧩 Which language makes a form box? (a) JavaScript (b) CSS (c) HTML
  25. 25.Which of these does HTML do? (a) puts a picture on a page (b) checks a quiz answer (c) adds space around boxes (d) sets colours and fonts
  26. 26.⚖️ What colour is the text of this element?
    <h2 class="note" id="top">Hi</h2>
    CSS:
    .note { color: green; }
    h2 { color: black; }
    (a) black (b) yellow (c) blue (d) green
  27. 27.🌈 Which colour is #00ff00? (a) yellow (b) bright green (c) cyan (d) red
  28. 28.⚖️ What colour is the text of this element?
    <p class="menu" id="intro">Hi</p>
    CSS:
    #intro { color: purple; }
    p { color: blue; }
    .menu { color: red; }
    (a) purple (b) blue (c) yellow (d) red
  29. 29.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 230px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  30. 30.⚖️ What colour is the text of this element?
    <h1 class="big" id="intro">Hi</h1>
    CSS:
    .big { color: black; }
    #intro { color: red; }
    h1 { color: yellow; }
    (a) black (b) orange (c) red (d) yellow
  31. 31.True or false: .star is an element selector. (a) False (b) True
  32. 32.⚖️ What colour is the text of this element?
    <h2 class="star" id="main">Hi</h2>
    CSS:
    .star { color: yellow; }
    .star { color: green; }
    (a) yellow (b) orange (c) red (d) green
  33. 33.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 160px;
      padding: 10px;
      border: 2px solid black;
      margin: 0px;
    }
  34. 34.🌈 Hex digits go 0 to 9, then A to which letter? (a) F (b) G (c) J (d) Z
  35. 35.🖌️ How big is the text, in px?
    li {
      font-size: 40px;
      color: yellow;
      background-color: red;
      text-align: center;
    }
  36. 36.🎯 Which element does the selector .red style? (a) <div id="red"> (b) <span class="star"> (c) <div class="box"> (d) <div class="red">
  37. 37.🌈 What is the biggest number one colour can have in rgb()? (a) 1000 (b) 99 (c) 100 (d) 255
  38. 38.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      text-align: center;
      margin: 10px;
      width: 300px;
      color: red;
    }
  39. 39.Which of these does JavaScript do? (a) puts a picture on a page (b) reacts to a button click (c) sets colours and fonts (d) makes a link
  40. 40.🎯 What kind of selector is .note? (a) an element selector (b) a class selector (c) an id selector

Answer key

  1. False
  2. 12
  3. CSS
  4. 60
  5. 800px or wider
  6. blue
  7. makes a link
  8. font-weight
  9. font-style
  10. font-size
  11. blue
  12. No
  13. adds space around boxes
  14. lays out the page
  15. 20
  16. JavaScript
  17. orange
  18. reacts to a button click
  19. border
  20. blue
  21. 70
  22. 159
  23. shows a pop-up message
  24. HTML
  25. puts a picture on a page
  26. green
  27. bright green
  28. purple
  29. 30
  30. red
  31. False
  32. green
  33. 184
  34. F
  35. 40
  36. <div class="red">
  37. 255
  38. 4
  39. reacts to a button click
  40. a class selector

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