← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 445 · 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: flex-end;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  2. 2.🌈 In #db0000 the red part is the hex number db. What is it as a normal number?
  3. 3.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      color: red;
      border: 2px solid;
      margin: 10px;
      font-size: 20px;
    }
  4. 4.🎨 What does CSS stand for? (a) Cascading Style Sheets (b) Creative Sheet System (c) Computer Style Sheets (d) Colourful Site Styles
  5. 5.🖌️ How big is the text, in px?
    p {
      font-size: 32px;
      text-align: left;
      color: blue;
      background-color: purple;
    }
  6. 6.⚖️ What colour is the text of this element?
    <p class="menu" id="top">Hi</p>
    CSS:
    p { color: yellow; }
    .menu { color: red; }
    (a) white (b) yellow (c) red (d) purple
  7. 7.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 24px;
      }
    }
  8. 8.🌈 Which colour of light is strongest in rgb(77, 229, 53)? (a) red (b) blue (c) green
  9. 9.🎯 Which CSS selector matches this element?
    <p class="box" id="end">Hello</p>
    (a) h1 (b) #box (c) .end (d) .box
  10. 10.🖌️ Where does the text sit on its line?
    h2 {
      background-color: green;
      text-align: left;
      color: white;
      font-size: 12px;
    }
    (a) on the right (b) on the left (c) in the middle
  11. 11.What does justify-content: center do? (a) equal gaps, none at ends (b) packs boxes at the start (c) packs boxes at the end (d) puts boxes in the middle
  12. 12.⚖️ What colour is the text of this element?
    <h1 class="big" id="main">Hi</h1>
    CSS:
    h1 { color: blue; }
    #main { color: red; }
    (a) blue (b) yellow (c) white (d) red
  13. 13.True or false: JavaScript makes a link. (a) False (b) True
  14. 14.✍️ What value is given to font-size in this rule?
    body {
      padding: 8px;
      font-weight: bold;
      font-size: 20px;
    }
    (a) yellow (b) center (c) 20px (d) font-size
  15. 15.🌈 Which hex code is cyan? (a) #00ff00 (b) #0000ff (c) #ff00ff (d) #00ffff
  16. 16.🌈 Which colour of light is strongest in rgb(217, 39, 30)? (a) blue (b) green (c) red
  17. 17.🎯 Which sign starts an id selector? (a) . (b) & (c) # (d) @
  18. 18.🎯 Which CSS selector matches this element?
    <span class="star" id="logo">Hello</span>
    (a) span (b) #star (c) #end (d) p
  19. 19.What does justify-content: flex-end 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
  20. 20.🎯 Which CSS selector matches this element?
    <h2 class="star" id="intro">Hello</h2>
    (a) #star (b) .menu (c) h2 (d) li
  21. 21.✍️ What value is given to color in this rule?
    body {
      padding: 8px;
      background-color: yellow;
      color: red;
      font-weight: bold;
    }
    (a) 20px (b) color (c) red (d) center
  22. 22.🌈 What is the biggest number one colour can have in rgb()? (a) 99 (b) 100 (c) 255 (d) 1000
  23. 23.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 2 (b) 4 (c) 6 (d) 3
  24. 24.🌈 In #rrggbb, which colour do the first two digits give? (a) blue (b) green (c) black (d) red
  25. 25.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      border: 2px solid;
    }
  26. 26.Which of these does CSS do? (a) changes the text size (b) shows a pop-up message (c) reacts to a button click (d) makes a form box
  27. 27.✍️ Which property is set to red in this rule?
    #top {
      color: red;
      text-align: center;
      background-color: yellow;
      width: 300px;
    }
    (a) text-align (b) red (c) font-size (d) color
  28. 28.Which of these does HTML do? (a) makes a link (b) shows a pop-up message (c) counts down a timer (d) lays out the page
  29. 29.🔍 Which is the odd one out? (a) shows a pop-up message (b) gives the page structure (c) counts down a timer (d) reacts to a button click
  30. 30.🧩 Which language puts a picture on a page? (a) CSS (b) JavaScript (c) HTML
  31. 31.✍️ In color: blue; which part is the value? (a) : (b) ; (c) color (d) blue
  32. 32.Which of these does HTML do? (a) shows a pop-up message (b) rounds box corners (c) changes the text size (d) puts a picture on a page
  33. 33.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 16px;
      }
    }
  34. 34.What does font-family do? (a) centres a heading (b) picks the font style (c) makes the text bold (d) sets the letter colour
  35. 35.✍️ Which sign goes between a property and its value? (a) ; (b) - (c) : (d) =
  36. 36.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 18px;
      }
    }
  37. 37.🧩 Which language shows a pop-up message? (a) JavaScript (b) CSS (c) HTML
  38. 38.🌈 Which colour is #0000ff? (a) blue (b) yellow (c) black (d) magenta
  39. 39.📦 In the box model, which part is space outside the border? (a) padding (b) content (c) border (d) margin
  40. 40.True or false: margin is the gap to other boxes. (a) False (b) True

Answer key

  1. 60
  2. 219
  3. 4
  4. Cascading Style Sheets
  5. 32
  6. red
  7. 24
  8. green
  9. .box
  10. on the left
  11. puts boxes in the middle
  12. red
  13. False
  14. 20px
  15. #00ffff
  16. red
  17. #
  18. span
  19. packs boxes at the end
  20. h2
  21. red
  22. 255
  23. 3
  24. red
  25. 1
  26. changes the text size
  27. color
  28. makes a link
  29. gives the page structure
  30. HTML
  31. blue
  32. puts a picture on a page
  33. 16
  34. picks the font style
  35. :
  36. 16
  37. JavaScript
  38. blue
  39. margin
  40. True

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