← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 100 · 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 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 28px;
      }
    }
  2. 2.✍️ What is the selector in this CSS rule?
    h2 {
      width: 300px;
      margin: 10px;
      color: red;
    }
    (a) h2 (b) width (c) h1 (d) 10px
  3. 3.🔍 Which is the odd one out? (a) lays out the page (b) changes the text size (c) makes a form box (d) rounds box corners
  4. 4.💪 Which justify-content value packs boxes at the start? (a) flex-end (b) center (c) flex-start (d) space-between
  5. 5.🧩 Which language gives the page structure? (a) JavaScript (b) CSS (c) HTML
  6. 6.🧩 Which language checks a quiz answer? (a) JavaScript (b) CSS (c) HTML
  7. 7.✍️ Which sign goes between a property and its value? (a) - (b) = (c) ; (d) :
  8. 8.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 220px;
      justify-content: center;
    }
    Inside are 3 boxes, each 40px wide (no margins).
  9. 9.What does color do? (a) sets the letter colour (b) picks the font style (c) makes letters bigger (d) colours behind the text
  10. 10.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      font-size: 20px;
      background-color: yellow;
      text-align: center;
    }
  11. 11.🎯 Which sign starts a class selector? (a) # (b) @ (c) . (d) &
  12. 12.🎯 Which element does the selector .box style? (a) <span class="menu"> (b) <div class="box"> (c) <div class="star"> (d) <div id="box">
  13. 13.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      border: 2px solid;
      font-weight: bold;
      color: red;
      font-style: italic;
    }
  14. 14.🌈 What is the biggest number one colour can have in rgb()? (a) 99 (b) 1000 (c) 100 (d) 255
  15. 15.🌈 In #00ff00 the green part is the hex number ff. What is it as a normal number?
  16. 16.⚖️ Two rules with the same selector set a colour. Which one wins? (a) neither (b) the later one (c) the shorter one (d) the first one
  17. 17.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 90px;
      padding: 20px;
      border: 2px solid black;
      margin: 10px;
    }
  18. 18.🎯 What kind of selector is .card? (a) an id selector (b) a class selector (c) an element selector
  19. 19.✍️ What is the selector in this CSS rule?
    h1 {
      font-style: italic;
      font-size: 20px;
      padding: 8px;
    }
    (a) h1 (b) font-style (c) 20px (d) p
  20. 20.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      border: 2px solid;
      font-size: 20px;
    }
  21. 21.💪 Which flexbox property picks row or column? (a) gap (b) flex-direction (c) display: flex (d) justify-content
  22. 22.⚖️ Which selector is the weakest? (a) an element selector (b) an id selector (c) a class selector
  23. 23.🎯 What kind of selector is #main? (a) an element selector (b) an id selector (c) a class selector
  24. 24.🎨 A CSS file usually ends with which extension? (a) .png (b) .html (c) .js (d) .css
  25. 25.🖌️ Which CSS property picks the font style? (a) background-color (b) color (c) font-family (d) font-size
  26. 26.What does font-family do? (a) sets the letter colour (b) centres a heading (c) makes the text bold (d) picks the font style
  27. 27.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 180px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 80px wide (no margins).
  28. 28.🌈 In #000f00 the green part is the hex number 0f. What is it as a normal number?
  29. 29.✍️ Which sign ends each CSS declaration? (a) : (b) . (c) , (d) ;
  30. 30.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      margin: 10px;
      width: 300px;
      border: 2px solid;
    }
  31. 31.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 310px;
      justify-content: flex-end;
    }
    Inside are 3 boxes, each 100px wide (no margins).
  32. 32.🖌️ What colour are the letters?
    h2 {
      color: blue;
      text-align: left;
      background-color: green;
      font-size: 28px;
    }
    (a) white (b) green (c) blue
  33. 33.✍️ What is the selector in this CSS rule?
    li {
      border: 2px solid;
      font-size: 20px;
    }
    (a) border (b) li (c) body (d) 20px
  34. 34.🎯 How many elements on a page should have the same id? (a) 2 (b) 5 (c) 1 (d) any number
  35. 35.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 300px;
      justify-content: space-between;
    }
    Inside are 3 boxes, each 60px wide (no margins).
  36. 36.⚖️ What colour is the text of this element?
    <p class="big" id="top">Hi</p>
    CSS:
    p { color: black; }
    p { color: orange; }
    (a) red (b) orange (c) blue (d) black
  37. 37.True or false: margin is the gap round content. (a) False (b) True
  38. 38.🎯 Which CSS selector matches this element?
    <span class="menu" id="top">Hello</span>
    (a) #top (b) .note (c) .top (d) #intro
  39. 39.🧩 Which language makes a link? (a) CSS (b) HTML (c) JavaScript
  40. 40.✍️ How many declarations (property: value pairs) are in this rule?
    body {
      background-color: yellow;
      border: 2px solid;
      width: 300px;
    }

Answer key

  1. 28
  2. h2
  3. makes a form box
  4. flex-start
  5. HTML
  6. JavaScript
  7. :
  8. 50
  9. sets the letter colour
  10. 3
  11. .
  12. <div class="box">
  13. 4
  14. 255
  15. 255
  16. the later one
  17. 154
  18. a class selector
  19. h1
  20. 2
  21. flex-direction
  22. an element selector
  23. an id selector
  24. .css
  25. font-family
  26. picks the font style
  27. 20
  28. 15
  29. ;
  30. 3
  31. 10
  32. blue
  33. li
  34. 1
  35. 60
  36. orange
  37. False
  38. #top
  39. HTML
  40. 3

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