← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 199 · 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.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 140px;
      justify-content: center;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  2. 2.⚖️ What colour is the text of this element?
    <h1 class="red" id="intro">Hi</h1>
    CSS:
    #intro { color: yellow; }
    #intro { color: blue; }
    (a) white (b) blue (c) yellow (d) purple
  3. 3.True or false: .card is a class selector. (a) True (b) False
  4. 4.📱 The screen is 1366px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 14px;
      }
    }
    (a) No (b) Yes
  5. 5.True or false: h1 is a class selector. (a) False (b) True
  6. 6.🌈 In #000000 the red part is the hex number 00. What is it as a normal number?
  7. 7.🌈 Which colour is rgb(0, 0, 0)? (a) blue (b) black (c) cyan (d) yellow
  8. 8.True or false: the border is the line round the box. (a) True (b) False
  9. 9.What does font-weight do? (a) sets the letter colour (b) makes the text bold (c) makes letters bigger (d) picks the font style
  10. 10.🖌️ Where does the text sit on its line?
    h1 {
      background-color: white;
      color: blue;
      text-align: center;
      font-size: 12px;
    }
    (a) in the middle (b) on the left (c) on the right
  11. 11.✍️ What value is given to border in this rule?
    #top {
      border: 2px solid;
      text-align: center;
      font-weight: bold;
    }
    (a) border (b) italic (c) 2px solid (d) 300px
  12. 12.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 280px;
      padding: 30px;
      border: 1px solid black;
      margin: 0px;
    }
  13. 13.📱 Responsive design means a page ___. (a) fits every screen (b) has no pictures (c) is only for laptops (d) never changes
  14. 14.🌈 Which hex code is black? (a) #ff00ff (b) #00ff00 (c) #ffffff (d) #000000
  15. 15.🎯 Which sign starts an id selector? (a) . (b) # (c) & (d) @
  16. 16.🎯 How many elements on a page should have the same id? (a) 1 (b) 5 (c) 2 (d) any number
  17. 17.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 110px;
      padding: 15px;
      border: 5px solid black;
      margin: 0px;
    }
  18. 18.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 6px;
      }
    }
    (a) No (b) Yes
  19. 19.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 90px;
      padding: 10px;
      border: 2px solid black;
      margin: 10px;
    }
  20. 20.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 110px;
      padding: 10px;
      border: 5px solid black;
      margin: 10px;
    }
  21. 21.🔍 Which is the odd one out? (a) makes headings and lists (b) counts down a timer (c) makes a form box (d) gives the page structure
  22. 22.🌈 Which colour is rgb(0, 255, 255)? (a) cyan (b) yellow (c) magenta (d) blue
  23. 23.⚖️ Two rules with the same selector set a colour. Which one wins? (a) neither (b) the first one (c) the later one (d) the shorter one
  24. 24.🌈 Which colour is rgb(255, 255, 255)? (a) black (b) red (c) white (d) yellow
  25. 25.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      font-style: italic;
    }
  26. 26.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 14px;
      }
    }
  27. 27.🌈 Which hex code is cyan? (a) #00ffff (b) #ffff00 (c) #ff0000 (d) #000000
  28. 28.✍️ Which property is set to red in this rule?
    body {
      width: 300px;
      color: red;
    }
    (a) red (b) font-size (c) color (d) text-align
  29. 29.What does justify-content: flex-start do? (a) packs boxes at the end (b) packs boxes at the start (c) puts boxes in the middle (d) equal gaps, none at ends
  30. 30.📱 max-width: 600px applies when the screen is ___. (a) turned off (b) 600px or narrower (c) exactly 1000px (d) 600px or wider
  31. 31.🧩 Which language changes the text size? (a) JavaScript (b) HTML (c) CSS
  32. 32.✍️ What value is given to font-style in this rule?
    p {
      font-style: italic;
      color: red;
    }
    (a) red (b) italic (c) font-style (d) 20px
  33. 33.✍️ What is the selector in this CSS rule?
    li {
      text-align: center;
      width: 300px;
      font-size: 20px;
      border: 2px solid;
    }
    (a) 300px (b) body (c) text-align (d) li
  34. 34.🖌️ What colour is behind the letters?
    h2 {
      background-color: purple;
      font-size: 12px;
      color: blue;
      text-align: left;
    }
    (a) blue (b) purple (c) red
  35. 35.🖌️ Which CSS property centres a heading? (a) font-weight (b) font-family (c) background-color (d) text-align
  36. 36.💪 Which justify-content value packs boxes at the end? (a) center (b) flex-start (c) space-between (d) flex-end
  37. 37.🎯 Which sign starts a class selector? (a) . (b) & (c) @ (d) #
  38. 38.⚖️ What colour is the text of this element?
    <p class="box" id="end">Hi</p>
    CSS:
    #end { color: red; }
    .box { color: yellow; }
    (a) red (b) yellow (c) purple (d) green
  39. 39.🌈 In #00005c the blue part is the hex number 5c. What is it as a normal number?
  40. 40.🖌️ What colour are the letters?
    li {
      font-size: 12px;
      text-align: left;
      color: red;
      background-color: blue;
    }
    (a) blue (b) purple (c) red

Answer key

  1. 30
  2. blue
  3. True
  4. No
  5. False
  6. 0
  7. black
  8. True
  9. makes the text bold
  10. in the middle
  11. 2px solid
  12. 342
  13. fits every screen
  14. #000000
  15. #
  16. 1
  17. 150
  18. Yes
  19. 134
  20. 160
  21. counts down a timer
  22. cyan
  23. the later one
  24. white
  25. 1
  26. 14
  27. #00ffff
  28. color
  29. packs boxes at the start
  30. 600px or narrower
  31. CSS
  32. italic
  33. li
  34. purple
  35. text-align
  36. flex-end
  37. .
  38. red
  39. 92
  40. red

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