← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 285 · 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.⚖️ What colour is the text of this element?
    <p class="box" id="intro">Hi</p>
    CSS:
    p { color: yellow; }
    p { color: blue; }
    (a) yellow (b) purple (c) red (d) blue
  2. 2.🖌️ Which CSS property sets the letter colour? (a) font-weight (b) font-size (c) color (d) background-color
  3. 3.🎯 Which element does the selector span style? (a) <p> (b) <h1 class="menu"> (c) <h2 id="intro"> (d) <span class="menu">
  4. 4.🎯 Can many elements share the same class? (a) Yes (b) No
  5. 5.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 210px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  6. 6.🌈 Which colour of light is strongest in rgb(72, 115, 164)? (a) red (b) blue (c) green
  7. 7.💪 Which flexbox property lines boxes up across? (a) align-items (b) gap (c) justify-content (d) display: flex
  8. 8.💪 Which flexbox property turns on flexbox? (a) flex-direction (b) justify-content (c) display: flex (d) gap
  9. 9.Which of these does HTML do? (a) lays out the page (b) sets colours and fonts (c) shows a pop-up message (d) makes a link
  10. 10.⚖️ What colour is the text of this element?
    <p class="note" id="hero">Hi</p>
    CSS:
    .note { color: purple; }
    #hero { color: red; }
    p { color: white; }
    (a) purple (b) white (c) red (d) black
  11. 11.📱 max-width: 600px applies when the screen is ___. (a) turned off (b) 600px or narrower (c) 600px or wider (d) exactly 1000px
  12. 12.✍️ What is the selector in this CSS rule?
    .note {
      font-weight: bold;
      margin: 10px;
      text-align: center;
      color: red;
    }
    (a) #top (b) font-weight (c) .note (d) 10px
  13. 13.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 230px;
      padding: 10px;
      border: 2px solid black;
      margin: 0px;
    }
  14. 14.🧩 Which language makes a form box? (a) CSS (b) JavaScript (c) HTML
  15. 15.🔍 Which is the odd one out? (a) reacts to a button click (b) lays out the page (c) checks a quiz answer (d) changes the page live
  16. 16.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 190px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  17. 17.🎯 Which CSS selector matches this element?
    <h1 class="star" id="top">Hello</h1>
    (a) h2 (b) #intro (c) #star (d) h1
  18. 18.✍️ What value is given to color in this rule?
    #top {
      color: red;
      border: 2px solid;
    }
    (a) red (b) 20px (c) center (d) color
  19. 19.🎯 Which element does the selector .menu style? (a) <div id="menu"> (b) <span class="big"> (c) <div class="note"> (d) <div class="menu">
  20. 20.🎯 Which CSS selector matches this element?
    <span class="box" id="top">Hello</span>
    (a) p (b) span (c) #box (d) #intro
  21. 21.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 320px;
      justify-content: flex-end;
    }
    Inside are 3 boxes, each 100px wide (no margins).
  22. 22.✍️ In color: blue; which part is the property? (a) ; (b) blue (c) color (d) :
  23. 23.✍️ Which property is set to 20px in this rule?
    body {
      font-size: 20px;
      text-align: center;
      color: red;
      background-color: yellow;
    }
    (a) text-align (b) 20px (c) font-size (d) background-color
  24. 24.⚖️ What colour is the text of this element?
    <p class="red" id="intro">Hi</p>
    CSS:
    .red { color: white; }
    p { color: blue; }
    (a) blue (b) white (c) red (d) yellow
  25. 25.What does justify-content: center do? (a) packs boxes at the start (b) puts boxes in the middle (c) equal gaps, none at ends (d) packs boxes at the end
  26. 26.🎯 Which sign starts a class selector? (a) @ (b) & (c) # (d) .
  27. 27.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 260px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  28. 28.💪 Which justify-content value equal gaps, none at ends? (a) flex-end (b) space-between (c) center (d) flex-start
  29. 29.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the later one (b) neither (c) the first one (d) the shorter one
  30. 30.🌈 Which colour is #ffffff? (a) white (b) cyan (c) red (d) magenta
  31. 31.🔍 Which is the odd one out? (a) adds space around boxes (b) rounds box corners (c) counts down a timer (d) sets colours and fonts
  32. 32.💪 Which justify-content value packs boxes at the start? (a) space-between (b) flex-start (c) flex-end (d) center
  33. 33.📱 Responsive design means a page ___. (a) never changes (b) is only for laptops (c) fits every screen (d) has no pictures
  34. 34.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 340px;
      justify-content: center;
    }
    Inside are 3 boxes, each 60px wide (no margins).
  35. 35.🖌️ Which CSS property colours behind the text? (a) font-family (b) background-color (c) color (d) font-size
  36. 36.📱 min-width: 800px applies when the screen is ___. (a) turned off (b) 800px or wider (c) exactly 100px (d) 800px or narrower
  37. 37.🎯 Which CSS selector matches this element?
    <h1 class="box" id="hero">Hello</h1>
    (a) .box (b) h2 (c) .star (d) #box
  38. 38.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 26px;
      }
    }
  39. 39.🌈 Which colour is rgb(0, 255, 0)? (a) cyan (b) bright green (c) red (d) black
  40. 40.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 130px;
      padding: 30px;
      border: 5px solid black;
      margin: 0px;
    }

Answer key

  1. blue
  2. color
  3. <span class="menu">
  4. Yes
  5. 10
  6. blue
  7. align-items
  8. display: flex
  9. makes a link
  10. red
  11. 600px or narrower
  12. .note
  13. 254
  14. HTML
  15. lays out the page
  16. 30
  17. h1
  18. red
  19. <div class="menu">
  20. span
  21. 20
  22. color
  23. font-size
  24. white
  25. puts boxes in the middle
  26. .
  27. 60
  28. space-between
  29. the later one
  30. white
  31. counts down a timer
  32. flex-start
  33. fits every screen
  34. 80
  35. background-color
  36. 800px or wider
  37. .box
  38. 26
  39. bright green
  40. 200

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