← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 406 · 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?
    <h1 class="note" id="hero">Hi</h1>
    CSS:
    .note { color: red; }
    .note { color: yellow; }
    (a) red (b) blue (c) white (d) yellow
  2. 2.💪 Which justify-content value puts boxes in the middle? (a) center (b) flex-end (c) space-between (d) flex-start
  3. 3.📱 The screen is 820px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 10px;
      }
    }
    (a) Yes (b) No
  4. 4.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 20px;
      }
    }
  5. 5.🌈 In #rrggbb, which colour do the last two digits give? (a) white (b) blue (c) green (d) red
  6. 6.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 430px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 100px wide (no margins).
  7. 7.📱 max-width: 600px applies when the screen is ___. (a) 600px or narrower (b) exactly 1000px (c) turned off (d) 600px or wider
  8. 8.🌈 Which colour is #ffff00? (a) white (b) yellow (c) bright green (d) black
  9. 9.🧩 Which language checks a quiz answer? (a) CSS (b) JavaScript (c) HTML
  10. 10.✍️ Which property is set to 300px in this rule?
    .box {
      font-style: italic;
      width: 300px;
      border: 2px solid;
    }
    (a) font-style (b) color (c) width (d) 300px
  11. 11.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 500px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 80px wide (no margins).
  12. 12.⚖️ Which selector is the strongest? (a) an id selector (b) an element selector (c) a class selector
  13. 13.🖌️ How big is the text, in px?
    h1 {
      background-color: white;
      text-align: right;
      color: purple;
      font-size: 24px;
    }
  14. 14.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 260px;
      justify-content: center;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  15. 15.✍️ What value is given to font-size in this rule?
    h1 {
      color: red;
      font-size: 20px;
    }
    (a) 20px (b) font-size (c) yellow (d) center
  16. 16.📱 What does a media query check? (a) the page title (b) the time of day (c) the screen width (d) the battery level
  17. 17.🖌️ Where does the text sit on its line?
    li {
      text-align: left;
      color: blue;
      background-color: white;
      font-size: 20px;
    }
    (a) on the right (b) on the left (c) in the middle
  18. 18.Which of these does HTML do? (a) makes a form box (b) reacts to a button click (c) shows a pop-up message (d) adds space around boxes
  19. 19.True or false: .note is an element selector. (a) False (b) True
  20. 20.🖌️ How big is the text, in px?
    h1 {
      text-align: left;
      background-color: green;
      font-size: 36px;
      color: orange;
    }
  21. 21.Which of these does JavaScript do? (a) sets colours and fonts (b) makes headings and lists (c) makes a form box (d) changes the page live
  22. 22.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 250px;
      padding: 25px;
      border: 2px solid black;
      margin: 20px;
    }
  23. 23.✍️ Which sign ends each CSS declaration? (a) , (b) ; (c) : (d) .
  24. 24.✍️ Which property is set to red in this rule?
    #top {
      font-style: italic;
      text-align: center;
      color: red;
      margin: 10px;
    }
    (a) red (b) color (c) font-size (d) text-align
  25. 25.True or false: HTML puts a picture on a page. (a) True (b) False
  26. 26.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 24px;
      }
    }
  27. 27.🌈 Which colour is rgb(0, 0, 255)? (a) yellow (b) blue (c) bright green (d) black
  28. 28.⚖️ What colour is the text of this element?
    <h1 class="star" id="intro">Hi</h1>
    CSS:
    h1 { color: purple; }
    h1 { color: blue; }
    (a) white (b) purple (c) orange (d) blue
  29. 29.🔍 Which is the odd one out? (a) reacts to a button click (b) makes headings and lists (c) makes a form box (d) puts a picture on a page
  30. 30.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 18px;
      }
    }
  31. 31.Which of these does JavaScript do? (a) checks a quiz answer (b) rounds box corners (c) makes a form box (d) makes headings and lists
  32. 32.🌈 Which colour is #ffffff? (a) yellow (b) blue (c) red (d) white
  33. 33.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the first one (b) the later one (c) neither (d) the shorter one
  34. 34.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 230px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  35. 35.True or false: .card is an element selector. (a) False (b) True
  36. 36.🖌️ How big is the text, in px?
    p {
      text-align: left;
      color: blue;
      font-size: 12px;
      background-color: white;
    }
  37. 37.🎯 Which CSS selector matches this element?
    <p class="note" id="main">Hello</p>
    (a) .note (b) h1 (c) #logo (d) .big
  38. 38.⚖️ What colour is the text of this element?
    <h2 class="note" id="intro">Hi</h2>
    CSS:
    .note { color: green; }
    h2 { color: yellow; }
    (a) orange (b) yellow (c) green (d) white
  39. 39.🎯 What kind of selector is li? (a) a class selector (b) an id selector (c) an element selector
  40. 40.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 130px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 60px wide (no margins).

Answer key

  1. yellow
  2. center
  3. No
  4. 20
  5. blue
  6. 10
  7. 600px or narrower
  8. yellow
  9. JavaScript
  10. width
  11. 60
  12. an id selector
  13. 24
  14. 80
  15. 20px
  16. the screen width
  17. on the left
  18. makes a form box
  19. False
  20. 36
  21. changes the page live
  22. 344
  23. ;
  24. color
  25. True
  26. 16
  27. blue
  28. blue
  29. reacts to a button click
  30. 20
  31. checks a quiz answer
  32. white
  33. the later one
  34. 70
  35. False
  36. 12
  37. .note
  38. green
  39. an element selector
  40. 10

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