← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 316 · 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: JavaScript counts down a timer. (a) False (b) True
  2. 2.⚖️ Which selector is the weakest? (a) an id selector (b) a class selector (c) an element selector
  3. 3.🌈 Which colour of light is strongest in rgb(31, 21, 219)? (a) red (b) blue (c) green
  4. 4.🌈 In #rrggbb, which colour do the first two digits give? (a) green (b) black (c) blue (d) red
  5. 5.🌈 What is the biggest number one colour can have in rgb()? (a) 100 (b) 1000 (c) 255 (d) 99
  6. 6.🧩 Which language adds space around boxes? (a) HTML (b) CSS (c) JavaScript
  7. 7.🎯 Which element does the selector #intro style? (a) <h1 id="main"> (b) <h2 class="note"> (c) <h1 class="intro"> (d) <h1 id="intro">
  8. 8.🔍 Which is the odd one out? (a) puts a picture on a page (b) gives the page structure (c) makes a link (d) sets colours and fonts
  9. 9.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the first one (b) the shorter one (c) neither (d) the later one
  10. 10.🌈 Which colour of light is strongest in rgb(195, 1, 120)? (a) blue (b) green (c) red
  11. 11.🎯 Which CSS selector matches this element?
    <span class="note" id="top">Hello</span>
    (a) #note (b) p (c) #intro (d) .note
  12. 12.⚖️ What colour is the text of this element?
    <p class="red" id="logo">Hi</p>
    CSS:
    #logo { color: blue; }
    #logo { color: orange; }
    (a) red (b) white (c) orange (d) blue
  13. 13.⚖️ Which selector is the strongest? (a) an element selector (b) a class selector (c) an id selector
  14. 14.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 80px;
      padding: 10px;
      border: 2px solid black;
      margin: 15px;
    }
  15. 15.🧩 Which language shows a pop-up message? (a) JavaScript (b) HTML (c) CSS
  16. 16.🌈 Which colour is #ffff00? (a) magenta (b) blue (c) yellow (d) red
  17. 17.What does font-weight do? (a) makes letters bigger (b) colours behind the text (c) makes the text bold (d) sets the letter colour
  18. 18.True or false: margin is space inside the border. (a) False (b) True
  19. 19.📱 Which tag helps phones show a page at the right size? (a) the br tag (b) the viewport meta tag (c) the hr tag (d) the title tag
  20. 20.🖌️ What colour are the letters?
    h2 {
      background-color: white;
      font-size: 20px;
      text-align: left;
      color: purple;
    }
    (a) purple (b) white (c) green
  21. 21.🌈 Which hex code is magenta? (a) #ff0000 (b) #ffffff (c) #00ffff (d) #ff00ff
  22. 22.🎯 Can many elements share the same class? (a) No (b) Yes
  23. 23.🌈 Which colour is rgb(0, 255, 255)? (a) magenta (b) bright green (c) black (d) cyan
  24. 24.🎯 What kind of selector is .card? (a) a class selector (b) an id selector (c) an element selector
  25. 25.⚖️ What colour is the text of this element?
    <h2 class="menu" id="main">Hi</h2>
    CSS:
    #main { color: black; }
    #main { color: green; }
    (a) purple (b) green (c) black (d) blue
  26. 26.🎯 Which element does the selector .star style? (a) <div id="star"> (b) <div class="star"> (c) <span class="note"> (d) <div class="menu">
  27. 27.Which of these is margin? (a) space inside the border (b) the text or picture (c) the line round the box (d) the gap to other boxes
  28. 28.⚖️ What colour is the text of this element?
    <h2 class="box" id="end">Hi</h2>
    CSS:
    .box { color: black; }
    .box { color: orange; }
    (a) black (b) blue (c) orange (d) purple
  29. 29.🖌️ Where does the text sit on its line?
    h1 {
      font-size: 32px;
      color: blue;
      background-color: green;
      text-align: center;
    }
    (a) on the right (b) on the left (c) in the middle
  30. 30.💪 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).
  31. 31.💪 Which justify-content value packs boxes at the start? (a) flex-end (b) space-between (c) center (d) flex-start
  32. 32.📱 max-width: 600px applies when the screen is ___. (a) 600px or narrower (b) turned off (c) 600px or wider (d) exactly 1000px
  33. 33.🌈 Which colour is rgb(255, 0, 0)? (a) blue (b) white (c) red (d) bright green
  34. 34.✍️ Which sign ends each CSS declaration? (a) ; (b) , (c) : (d) .
  35. 35.✍️ Which property is set to bold in this rule?
    p {
      font-weight: bold;
      background-color: yellow;
    }
    (a) font-weight (b) bold (c) border (d) width
  36. 36.🌈 Which colour is #ff00ff? (a) bright green (b) black (c) magenta (d) yellow
  37. 37.🌈 Which colour is #ff0000? (a) yellow (b) white (c) red (d) magenta
  38. 38.Which of these does CSS do? (a) shows a pop-up message (b) checks a quiz answer (c) adds space around boxes (d) changes the page live
  39. 39.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 320px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 60px wide (no margins).
  40. 40.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 190px;
      padding: 5px;
      border: 5px solid black;
      margin: 0px;
    }

Answer key

  1. True
  2. an element selector
  3. blue
  4. red
  5. 255
  6. CSS
  7. <h1 id="intro">
  8. sets colours and fonts
  9. the later one
  10. red
  11. .note
  12. orange
  13. an id selector
  14. 134
  15. JavaScript
  16. yellow
  17. makes the text bold
  18. False
  19. the viewport meta tag
  20. purple
  21. #ff00ff
  22. Yes
  23. cyan
  24. a class selector
  25. green
  26. <div class="star">
  27. the gap to other boxes
  28. orange
  29. in the middle
  30. 60
  31. flex-start
  32. 600px or narrower
  33. red
  34. ;
  35. font-weight
  36. magenta
  37. red
  38. adds space around boxes
  39. 80
  40. 210

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