← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 527 · 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 375px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 18px;
      }
    }
    (a) Yes (b) No
  2. 2.🔍 Which is the odd one out? (a) counts down a timer (b) checks a quiz answer (c) shows a pop-up message (d) rounds box corners
  3. 3.✍️ Which sign ends each CSS declaration? (a) ; (b) . (c) : (d) ,
  4. 4.✍️ Which sign goes between a property and its value? (a) : (b) = (c) - (d) ;
  5. 5.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 240px;
      justify-content: center;
    }
    Inside are 2 boxes, each 80px wide (no margins).
  6. 6.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 10px;
      }
    }
  7. 7.✍️ How many declarations (property: value pairs) are in this rule?
    body {
      margin: 10px;
      font-size: 20px;
    }
  8. 8.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 18px;
      }
    }
  9. 9.⚖️ Which selector is the strongest? (a) a class selector (b) an id selector (c) an element selector
  10. 10.Which of these is the content? (a) the line round the box (b) the text or picture (c) a solid or dotted edge (d) space outside the border
  11. 11.True or false: CSS adds space around boxes. (a) True (b) False
  12. 12.🌈 Which hex code is yellow? (a) #00ffff (b) #0000ff (c) #ff0000 (d) #ffff00
  13. 13.📱 The screen is 820px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 14px;
      }
    }
    (a) Yes (b) No
  14. 14.✍️ What is the selector in this CSS rule?
    p {
      border: 2px solid;
      background-color: yellow;
      font-size: 20px;
      font-weight: bold;
    }
    (a) .note (b) yellow (c) border (d) p
  15. 15.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 140px;
      padding: 5px;
      border: 2px solid black;
      margin: 10px;
    }
  16. 16.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 60px;
      padding: 15px;
      border: 3px solid black;
      margin: 0px;
    }
  17. 17.✍️ How does a CSS comment start? (a) <!-- (b) # (c) /* (d) //
  18. 18.Which of these is the border? (a) space inside the border (b) a solid or dotted edge (c) the text or picture (d) the gap round content
  19. 19.🧩 Which language rounds box corners? (a) CSS (b) JavaScript (c) HTML
  20. 20.🧩 Which language counts down a timer? (a) HTML (b) JavaScript (c) CSS
  21. 21.True or false: padding is the gap round content. (a) False (b) True
  22. 22.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      width: 300px;
      font-weight: bold;
      background-color: yellow;
      font-size: 20px;
    }
  23. 23.Which of these is margin? (a) a solid or dotted edge (b) the gap round content (c) the text or picture (d) the gap to other boxes
  24. 24.✍️ In color: blue; which part is the value? (a) color (b) ; (c) : (d) blue
  25. 25.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      font-style: italic;
      margin: 10px;
      width: 300px;
    }
  26. 26.📱 Which tag helps phones show a page at the right size? (a) the viewport meta tag (b) the title tag (c) the br tag (d) the hr tag
  27. 27.✍️ Which property is set to bold in this rule?
    #top {
      color: red;
      font-weight: bold;
      text-align: center;
    }
    (a) border (b) font-weight (c) width (d) bold
  28. 28.🎯 Which CSS selector matches this element?
    <p class="menu" id="hero">Hello</p>
    (a) #menu (b) #hero (c) .note (d) h1
  29. 29.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      margin: 10px;
    }
  30. 30.🌈 Which colour of light is strongest in rgb(126, 60, 220)? (a) red (b) blue (c) green
  31. 31.🖌️ What colour is behind the letters?
    li {
      color: white;
      text-align: center;
      font-size: 12px;
      background-color: black;
    }
    (a) white (b) yellow (c) black
  32. 32.⚖️ What colour is the text of this element?
    <h2 class="big" id="top">Hi</h2>
    CSS:
    #top { color: black; }
    h2 { color: yellow; }
    .big { color: red; }
    (a) red (b) black (c) yellow (d) white
  33. 33.🖌️ Where does the text sit on its line?
    h2 {
      color: blue;
      font-size: 20px;
      text-align: right;
      background-color: red;
    }
    (a) on the left (b) on the right (c) in the middle
  34. 34.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the later one (b) the first one (c) neither (d) the shorter one
  35. 35.What does text-align do? (a) sets the letter colour (b) makes the text bold (c) centres a heading (d) picks the font style
  36. 36.🌈 Which colour is rgb(255, 0, 0)? (a) yellow (b) white (c) red (d) black
  37. 37.🖌️ Which CSS property centres a heading? (a) background-color (b) font-family (c) font-size (d) text-align
  38. 38.⚖️ What colour is the text of this element?
    <h1 class="red" id="main">Hi</h1>
    CSS:
    h1 { color: red; }
    .red { color: white; }
    (a) white (b) orange (c) red (d) black
  39. 39.📦 In the box model, which part is space outside the border? (a) padding (b) border (c) margin (d) content
  40. 40.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 6px;
      }
    }

Answer key

  1. No
  2. rounds box corners
  3. ;
  4. :
  5. 40
  6. 10
  7. 2
  8. 18
  9. an id selector
  10. the text or picture
  11. True
  12. #ffff00
  13. Yes
  14. p
  15. 174
  16. 96
  17. /*
  18. a solid or dotted edge
  19. CSS
  20. JavaScript
  21. True
  22. 4
  23. the gap to other boxes
  24. blue
  25. 3
  26. the viewport meta tag
  27. font-weight
  28. #hero
  29. 1
  30. blue
  31. black
  32. black
  33. on the right
  34. the later one
  35. centres a heading
  36. red
  37. text-align
  38. white
  39. margin
  40. 6

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