← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 970 · 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.Which of these does JavaScript do? (a) changes the page live (b) makes a form box (c) changes the text size (d) puts a picture on a page
  2. 2.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 18px;
      }
    }
  3. 3.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 18px;
      }
    }
    (a) No (b) Yes
  4. 4.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 360px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 100px wide (no margins).
  5. 5.🖌️ What colour are the letters?
    li {
      text-align: left;
      background-color: yellow;
      color: white;
      font-size: 32px;
    }
    (a) yellow (b) white (c) blue
  6. 6.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 50px;
      padding: 30px;
      border: 4px solid black;
      margin: 0px;
    }
  7. 7.📱 Which tag helps phones show a page at the right size? (a) the br tag (b) the title tag (c) the hr tag (d) the viewport meta tag
  8. 8.📦 In the box model, which part is a solid or dotted edge? (a) margin (b) content (c) padding (d) border
  9. 9.🔍 Which is the odd one out? (a) sets colours and fonts (b) lays out the page (c) puts a picture on a page (d) changes the text size
  10. 10.💪 Which justify-content value packs boxes at the end? (a) flex-start (b) center (c) space-between (d) flex-end
  11. 11.True or false: CSS adds space around boxes. (a) False (b) True
  12. 12.⚖️ What colour is the text of this element?
    <h2 class="menu" id="intro">Hi</h2>
    CSS:
    .menu { color: blue; }
    .menu { color: white; }
    (a) black (b) yellow (c) blue (d) white
  13. 13.✍️ Which property is set to center in this rule?
    h2 {
      text-align: center;
      font-weight: bold;
    }
    (a) background-color (b) margin (c) text-align (d) center
  14. 14.True or false: .big is a class selector. (a) True (b) False
  15. 15.🌈 In #rrggbb, which colour do the last two digits give? (a) white (b) blue (c) green (d) red
  16. 16.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 250px;
      padding: 5px;
      border: 5px solid black;
      margin: 10px;
    }
  17. 17.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 210px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 50px wide (no margins).
  18. 18.What does justify-content: center do? (a) puts boxes in the middle (b) packs boxes at the start (c) equal gaps, none at ends (d) packs boxes at the end
  19. 19.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 18px;
      }
    }
  20. 20.What does font-family do? (a) makes letters bigger (b) sets the letter colour (c) picks the font style (d) centres a heading
  21. 21.What does text-align do? (a) sets the letter colour (b) centres a heading (c) makes letters bigger (d) colours behind the text
  22. 22.✍️ Which property is set to 20px in this rule?
    h1 {
      font-size: 20px;
      margin: 10px;
      width: 300px;
      padding: 8px;
    }
    (a) 20px (b) text-align (c) background-color (d) font-size
  23. 23.✍️ In color: blue; which part is the property? (a) blue (b) : (c) ; (d) color
  24. 24.Which of these is padding? (a) the line round the box (b) the gap to other boxes (c) space outside the border (d) the gap round content
  25. 25.✍️ What value is given to width in this rule?
    p {
      color: red;
      width: 300px;
    }
    (a) width (b) red (c) 300px (d) italic
  26. 26.🖌️ What colour are the letters?
    li {
      font-size: 32px;
      color: orange;
      background-color: blue;
      text-align: center;
    }
    (a) yellow (b) blue (c) orange
  27. 27.🖌️ Where does the text sit on its line?
    p {
      text-align: center;
      font-size: 20px;
      color: green;
      background-color: orange;
    }
    (a) in the middle (b) on the left (c) on the right
  28. 28.🌈 Which colour is rgb(0, 0, 255)? (a) yellow (b) bright green (c) magenta (d) blue
  29. 29.⚖️ What colour is the text of this element?
    <p class="big" id="main">Hi</p>
    CSS:
    p { color: red; }
    p { color: green; }
    (a) blue (b) red (c) black (d) green
  30. 30.🌈 Which colour of light is strongest in rgb(169, 127, 62)? (a) red (b) green (c) blue
  31. 31.What does justify-content: space-between 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
  32. 32.🎯 Which CSS selector matches this element?
    <h2 class="menu" id="logo">Hello</h2>
    (a) .note (b) .logo (c) #menu (d) h2
  33. 33.🧩 Which language shows a pop-up message? (a) CSS (b) JavaScript (c) HTML
  34. 34.✍️ Which sign ends each CSS declaration? (a) , (b) . (c) ; (d) :
  35. 35.🎯 Which sign starts a class selector? (a) . (b) # (c) & (d) @
  36. 36.🖌️ What colour are the letters?
    h1 {
      background-color: purple;
      text-align: left;
      font-size: 28px;
      color: yellow;
    }
    (a) white (b) yellow (c) purple
  37. 37.🌈 What is the biggest number one colour can have in rgb()? (a) 100 (b) 255 (c) 1000 (d) 99
  38. 38.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      border: 2px solid;
      text-align: center;
      padding: 8px;
    }
  39. 39.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 14px;
      }
    }
    (a) No (b) Yes
  40. 40.🎯 What kind of selector is #main? (a) a class selector (b) an element selector (c) an id selector

Answer key

  1. changes the page live
  2. 24
  3. No
  4. 60
  5. white
  6. 118
  7. the viewport meta tag
  8. border
  9. puts a picture on a page
  10. flex-end
  11. True
  12. white
  13. text-align
  14. True
  15. blue
  16. 290
  17. 60
  18. puts boxes in the middle
  19. 18
  20. picks the font style
  21. centres a heading
  22. font-size
  23. color
  24. the gap round content
  25. 300px
  26. orange
  27. in the middle
  28. blue
  29. green
  30. red
  31. equal gaps, none at ends
  32. h2
  33. JavaScript
  34. ;
  35. .
  36. yellow
  37. 255
  38. 3
  39. No
  40. an id selector

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