← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 956 · 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.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) the later one (c) neither (d) the first one
  2. 2.True or false: JavaScript reacts to a button click. (a) False (b) True
  3. 3.🖌️ What colour is behind the letters?
    h1 {
      font-size: 24px;
      color: blue;
      text-align: left;
      background-color: white;
    }
    (a) yellow (b) white (c) blue
  4. 4.🔍 Which is the odd one out? (a) sets colours and fonts (b) counts down a timer (c) lays out the page (d) changes the text size
  5. 5.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 8px;
      }
    }
    (a) No (b) Yes
  6. 6.What does font-size do? (a) makes letters bigger (b) makes the text bold (c) picks the font style (d) centres a heading
  7. 7.✍️ Which property is set to red in this rule?
    .note {
      font-weight: bold;
      font-size: 20px;
      width: 300px;
      color: red;
    }
    (a) font-size (b) red (c) text-align (d) color
  8. 8.🖌️ Where does the text sit on its line?
    p {
      text-align: left;
      font-size: 24px;
      color: blue;
      background-color: red;
    }
    (a) on the left (b) in the middle (c) on the right
  9. 9.💪 Which justify-content value packs boxes at the start? (a) center (b) flex-start (c) space-between (d) flex-end
  10. 10.⚖️ Which selector is the strongest? (a) an id selector (b) an element selector (c) a class selector
  11. 11.🧩 Which language puts a picture on a page? (a) JavaScript (b) CSS (c) HTML
  12. 12.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 90px;
      padding: 15px;
      border: 4px solid black;
      margin: 20px;
    }
  13. 13.True or false: JavaScript changes the page live. (a) True (b) False
  14. 14.True or false: CSS sets colours and fonts. (a) False (b) True
  15. 15.🌈 Which colour is #ffffff? (a) white (b) black (c) cyan (d) bright green
  16. 16.📱 max-width: 600px applies when the screen is ___. (a) exactly 1000px (b) turned off (c) 600px or wider (d) 600px or narrower
  17. 17.🎯 What kind of selector is .big? (a) a class selector (b) an element selector (c) an id selector
  18. 18.🔍 Which is the odd one out? (a) makes a form box (b) makes headings and lists (c) makes a link (d) changes the page live
  19. 19.🌈 Which colour of light is strongest in rgb(105, 237, 106)? (a) red (b) blue (c) green
  20. 20.🌈 Which colour is #00ff00? (a) yellow (b) black (c) white (d) bright green
  21. 21.✍️ Which sign ends each CSS declaration? (a) : (b) ; (c) , (d) .
  22. 22.🖌️ Which CSS property colours behind the text? (a) color (b) text-align (c) background-color (d) font-weight
  23. 23.💪 Which justify-content value equal gaps, none at ends? (a) flex-end (b) space-between (c) center (d) flex-start
  24. 24.✍️ What is the selector in this CSS rule?
    li {
      color: red;
      margin: 10px;
    }
    (a) 10px (b) color (c) body (d) li
  25. 25.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 22px;
      }
    }
  26. 26.🎯 What kind of selector is #end? (a) an element selector (b) a class selector (c) an id selector
  27. 27.🖌️ What colour is behind the letters?
    p {
      font-size: 12px;
      color: yellow;
      background-color: blue;
      text-align: right;
    }
    (a) yellow (b) black (c) blue
  28. 28.What does justify-content: center do? (a) packs boxes at the end (b) packs boxes at the start (c) equal gaps, none at ends (d) puts boxes in the middle
  29. 29.💪 Which flexbox property picks row or column? (a) justify-content (b) display: flex (c) align-items (d) flex-direction
  30. 30.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 260px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  31. 31.⚖️ What colour is the text of this element?
    <h2 class="note" id="intro">Hi</h2>
    CSS:
    .note { color: orange; }
    .note { color: blue; }
    (a) orange (b) blue (c) purple (d) red
  32. 32.🎯 Which CSS selector matches this element?
    <h1 class="box" id="logo">Hello</h1>
    (a) #box (b) h1 (c) #end (d) .logo
  33. 33.✍️ What value is given to width in this rule?
    .note {
      padding: 8px;
      font-style: italic;
      margin: 10px;
      width: 300px;
    }
    (a) width (b) italic (c) red (d) 300px
  34. 34.🎨 Which tag holds CSS inside the head? (a) <body> (b) <css> (c) <style> (d) <script>
  35. 35.🖌️ Which CSS property sets the letter colour? (a) font-weight (b) background-color (c) color (d) font-size
  36. 36.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 270px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 60px wide (no margins).
  37. 37.⚖️ What colour is the text of this element?
    <h2 class="big" id="end">Hi</h2>
    CSS:
    .big { color: orange; }
    h2 { color: black; }
    #end { color: white; }
    (a) green (b) black (c) white (d) orange
  38. 38.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 170px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 80px wide (no margins).
  39. 39.🎯 What kind of selector is #hero? (a) an id selector (b) a class selector (c) an element selector
  40. 40.🌈 Which colour is rgb(0, 0, 255)? (a) blue (b) black (c) magenta (d) red

Answer key

  1. the later one
  2. True
  3. white
  4. counts down a timer
  5. Yes
  6. makes letters bigger
  7. color
  8. on the left
  9. flex-start
  10. an id selector
  11. HTML
  12. 168
  13. True
  14. True
  15. white
  16. 600px or narrower
  17. a class selector
  18. changes the page live
  19. green
  20. bright green
  21. ;
  22. background-color
  23. space-between
  24. li
  25. 24
  26. an id selector
  27. blue
  28. puts boxes in the middle
  29. flex-direction
  30. 60
  31. blue
  32. h1
  33. 300px
  34. <style>
  35. color
  36. 30
  37. white
  38. 10
  39. an id selector
  40. blue

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