← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 522 · 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.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 32px;
      }
    }
    (a) No (b) Yes
  2. 2.True or false: the border is the gap to other boxes. (a) True (b) False
  3. 3.🔍 Which is the odd one out? (a) changes the text size (b) shows a pop-up message (c) rounds box corners (d) lays out the page
  4. 4.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 250px;
      padding: 20px;
      border: 3px solid black;
      margin: 0px;
    }
  5. 5.🌈 In #rrggbb, which colour do the last two digits give? (a) white (b) red (c) green (d) blue
  6. 6.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 6px;
      }
    }
  7. 7.⚖️ What colour is the text of this element?
    <h2 class="star" id="main">Hi</h2>
    CSS:
    h2 { color: blue; }
    .star { color: green; }
    (a) blue (b) green (c) purple (d) white
  8. 8.What does font-size do? (a) colours behind the text (b) makes the text bold (c) sets the letter colour (d) makes letters bigger
  9. 9.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 200px;
      padding: 30px;
      border: 2px solid black;
      margin: 0px;
    }
  10. 10.🌈 Which hex code is bright green? (a) #ffff00 (b) #0000ff (c) #00ff00 (d) #00ffff
  11. 11.⚖️ What colour is the text of this element?
    <h2 class="big" id="top">Hi</h2>
    CSS:
    .big { color: green; }
    #top { color: blue; }
    (a) black (b) blue (c) orange (d) green
  12. 12.🌈 Which hex code is blue? (a) #ff00ff (b) #ff0000 (c) #0000ff (d) #000000
  13. 13.💪 Which justify-content value puts boxes in the middle? (a) center (b) space-between (c) flex-start (d) flex-end
  14. 14.📱 What does a media query check? (a) the page title (b) the time of day (c) the battery level (d) the screen width
  15. 15.⚖️ What colour is the text of this element?
    <h2 class="big" id="logo">Hi</h2>
    CSS:
    .big { color: white; }
    .big { color: yellow; }
    (a) white (b) green (c) blue (d) yellow
  16. 16.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 50px;
      padding: 20px;
      border: 4px solid black;
      margin: 15px;
    }
  17. 17.🌈 Which colour is rgb(0, 0, 255)? (a) black (b) red (c) blue (d) magenta
  18. 18.🎨 Which tag holds CSS inside the head? (a) <style> (b) <script> (c) <body> (d) <css>
  19. 19.💪 Which flexbox property spaces boxes along a row? (a) justify-content (b) align-items (c) flex-direction (d) display: flex
  20. 20.Which of these does CSS do? (a) gives the page structure (b) sets colours and fonts (c) shows a pop-up message (d) makes a form box
  21. 21.🌈 Which hex code is yellow? (a) #ff0000 (b) #ffff00 (c) #00ffff (d) #000000
  22. 22.🌈 In #000001 the blue part is the hex number 01. What is it as a normal number?
  23. 23.✍️ What is the selector in this CSS rule?
    #top {
      width: 300px;
      color: red;
    }
    (a) red (b) li (c) #top (d) width
  24. 24.🖌️ What colour are the letters?
    h1 {
      font-size: 16px;
      background-color: red;
      color: yellow;
      text-align: left;
    }
    (a) red (b) blue (c) yellow
  25. 25.✍️ In color: blue; which part is the property? (a) : (b) blue (c) color (d) ;
  26. 26.🌈 Which colour of light is strongest in rgb(232, 90, 113)? (a) green (b) red (c) blue
  27. 27.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 8px;
      }
    }
  28. 28.🔍 Which is the odd one out? (a) puts a picture on a page (b) makes a link (c) makes headings and lists (d) counts down a timer
  29. 29.🎯 Which sign starts a class selector? (a) @ (b) # (c) & (d) .
  30. 30.🌈 In #ad0000 the red part is the hex number ad. What is it as a normal number?
  31. 31.🖌️ Where does the text sit on its line?
    li {
      color: green;
      background-color: purple;
      text-align: left;
      font-size: 24px;
    }
    (a) on the right (b) on the left (c) in the middle
  32. 32.What does font-family do? (a) sets the letter colour (b) picks the font style (c) makes letters bigger (d) colours behind the text
  33. 33.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 20px;
      }
    }
  34. 34.✍️ Which property is set to center in this rule?
    .box {
      width: 300px;
      font-weight: bold;
      background-color: yellow;
      text-align: center;
    }
    (a) center (b) margin (c) text-align (d) background-color
  35. 35.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 140px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  36. 36.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 130px;
      padding: 5px;
      border: 3px solid black;
      margin: 20px;
    }
  37. 37.🖌️ What colour is behind the letters?
    h2 {
      color: red;
      background-color: blue;
      font-size: 32px;
      text-align: left;
    }
    (a) green (b) red (c) blue
  38. 38.💪 Which flexbox property turns on flexbox? (a) gap (b) display: flex (c) flex-direction (d) align-items
  39. 39.🎯 Which CSS selector matches this element?
    <p class="menu" id="intro">Hello</p>
    (a) .note (b) #menu (c) .menu (d) #main
  40. 40.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 22px;
      }
    }
    (a) No (b) Yes

Answer key

  1. No
  2. False
  3. shows a pop-up message
  4. 296
  5. blue
  6. 6
  7. green
  8. makes letters bigger
  9. 264
  10. #00ff00
  11. blue
  12. #0000ff
  13. center
  14. the screen width
  15. yellow
  16. 128
  17. blue
  18. <style>
  19. justify-content
  20. sets colours and fonts
  21. #ffff00
  22. 1
  23. #top
  24. yellow
  25. color
  26. red
  27. 12
  28. counts down a timer
  29. .
  30. 173
  31. on the left
  32. picks the font style
  33. 16
  34. text-align
  35. 40
  36. 186
  37. blue
  38. display: flex
  39. .menu
  40. Yes

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