← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 473 · 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.✍️ What value is given to text-align in this rule?
    .note {
      font-size: 20px;
      text-align: center;
    }
    (a) center (b) 10px (c) yellow (d) text-align
  2. 2.True or false: .big is an id selector. (a) True (b) False
  3. 3.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 280px;
      justify-content: space-between;
    }
    Inside are 3 boxes, each 80px wide (no margins).
  4. 4.✍️ Which sign ends each CSS declaration? (a) , (b) ; (c) . (d) :
  5. 5.🔍 Which is the odd one out? (a) reacts to a button click (b) sets colours and fonts (c) checks a quiz answer (d) shows a pop-up message
  6. 6.What does justify-content: center do? (a) packs boxes at the start (b) equal gaps, none at ends (c) puts boxes in the middle (d) packs boxes at the end
  7. 7.✍️ What is the selector in this CSS rule?
    .note {
      font-size: 20px;
      font-weight: bold;
      font-style: italic;
    }
    (a) #top (b) bold (c) font-size (d) .note
  8. 8.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 18px;
      }
    }
    (a) No (b) Yes
  9. 9.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      text-align: center;
    }
  10. 10.📦 In the box model, which part is space outside the border? (a) border (b) padding (c) content (d) margin
  11. 11.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 160px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  12. 12.✍️ CSS declarations go inside which brackets? (a) { } (b) [ ] (c) < > (d) ( )
  13. 13.🎯 Which element does the selector p style? (a) <li id="end"> (b) <h1> (c) <h2 class="box"> (d) <p class="box">
  14. 14.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 180px;
      padding: 15px;
      border: 4px solid black;
      margin: 20px;
    }
  15. 15.🌈 In #d30000 the red part is the hex number d3. What is it as a normal number?
  16. 16.🎯 Which element does the selector h1 style? (a) <li class="box"> (b) <h1 class="box"> (c) <div id="logo"> (d) <h2>
  17. 17.💪 Which justify-content value packs boxes at the end? (a) space-between (b) center (c) flex-start (d) flex-end
  18. 18.⚖️ Which selector is the weakest? (a) an id selector (b) a class selector (c) an element selector
  19. 19.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 150px;
      padding: 30px;
      border: 5px solid black;
      margin: 10px;
    }
  20. 20.🧩 Which language adds space around boxes? (a) JavaScript (b) HTML (c) CSS
  21. 21.⚖️ Which selector is the strongest? (a) an id selector (b) an element selector (c) a class selector
  22. 22.True or false: JavaScript lays out the page. (a) False (b) True
  23. 23.What does font-family do? (a) centres a heading (b) picks the font style (c) makes letters bigger (d) colours behind the text
  24. 24.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 10px;
      }
    }
    (a) No (b) Yes
  25. 25.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      color: red;
      border: 2px solid;
      margin: 10px;
    }
  26. 26.📱 Which tag helps phones show a page at the right size? (a) the viewport meta tag (b) the title tag (c) the hr tag (d) the br tag
  27. 27.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 120px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  28. 28.🖌️ Which CSS property picks the font style? (a) font-weight (b) text-align (c) font-family (d) background-color
  29. 29.🎯 What kind of selector is #main? (a) an id selector (b) a class selector (c) an element selector
  30. 30.🔍 Which is the odd one out? (a) makes headings and lists (b) puts a picture on a page (c) reacts to a button click (d) makes a form box
  31. 31.What does justify-content: space-between 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
  32. 32.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 100px;
      padding: 5px;
      border: 2px solid black;
      margin: 10px;
    }
  33. 33.⚖️ What colour is the text of this element?
    <h2 class="menu" id="hero">Hi</h2>
    CSS:
    h2 { color: green; }
    h2 { color: blue; }
    (a) green (b) orange (c) blue (d) yellow
  34. 34.🌈 Which colour is #ffff00? (a) white (b) bright green (c) yellow (d) red
  35. 35.Which of these does CSS do? (a) checks a quiz answer (b) changes the page live (c) lays out the page (d) makes headings and lists
  36. 36.🌈 In #rrggbb, which colour do the last two digits give? (a) blue (b) white (c) red (d) green
  37. 37.🎯 Which sign starts a class selector? (a) & (b) @ (c) . (d) #
  38. 38.💪 Which justify-content value puts boxes in the middle? (a) flex-start (b) space-between (c) center (d) flex-end
  39. 39.✍️ In color: blue; which part is the property? (a) blue (b) color (c) : (d) ;
  40. 40.🌈 Which colour of light is strongest in rgb(8, 197, 44)? (a) blue (b) green (c) red

Answer key

  1. center
  2. False
  3. 20
  4. ;
  5. sets colours and fonts
  6. puts boxes in the middle
  7. .note
  8. Yes
  9. 1
  10. margin
  11. 80
  12. { }
  13. <p class="box">
  14. 258
  15. 211
  16. <h1 class="box">
  17. flex-end
  18. an element selector
  19. 220
  20. CSS
  21. an id selector
  22. False
  23. picks the font style
  24. Yes
  25. 3
  26. the viewport meta tag
  27. 20
  28. font-family
  29. an id selector
  30. reacts to a button click
  31. equal gaps, none at ends
  32. 114
  33. blue
  34. yellow
  35. lays out the page
  36. blue
  37. .
  38. center
  39. color
  40. green

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