← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 391 · 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 wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 380px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 80px wide (no margins).
  2. 2.⚖️ What colour is the text of this element?
    <h1 class="big" id="logo">Hi</h1>
    CSS:
    h1 { color: purple; }
    #logo { color: orange; }
    .big { color: white; }
    (a) white (b) black (c) orange (d) purple
  3. 3.True or false: CSS counts down a timer. (a) False (b) True
  4. 4.🌈 Which colour is #0000ff? (a) red (b) blue (c) magenta (d) white
  5. 5.✍️ What is the selector in this CSS rule?
    body {
      font-size: 20px;
      background-color: yellow;
    }
    (a) yellow (b) .box (c) font-size (d) body
  6. 6.🔍 Which is the odd one out? (a) rounds box corners (b) makes headings and lists (c) gives the page structure (d) puts a picture on a page
  7. 7.⚖️ What colour is the text of this element?
    <p class="note" id="top">Hi</p>
    CSS:
    p { color: orange; }
    p { color: yellow; }
    (a) yellow (b) green (c) blue (d) orange
  8. 8.🧩 Which language changes the page live? (a) CSS (b) HTML (c) JavaScript
  9. 9.💪 Which justify-content value puts boxes in the middle? (a) space-between (b) flex-start (c) flex-end (d) center
  10. 10.What does justify-content: flex-end do? (a) puts boxes in the middle (b) equal gaps, none at ends (c) packs boxes at the start (d) packs boxes at the end
  11. 11.🔍 Which is the odd one out? (a) checks a quiz answer (b) puts a picture on a page (c) counts down a timer (d) changes the page live
  12. 12.🌈 Which colour is #ff0000? (a) bright green (b) cyan (c) red (d) blue
  13. 13.🖌️ What colour are the letters?
    li {
      background-color: orange;
      font-size: 12px;
      color: black;
      text-align: right;
    }
    (a) orange (b) blue (c) black
  14. 14.✍️ Which sign ends each CSS declaration? (a) , (b) ; (c) : (d) .
  15. 15.📱 What does a media query check? (a) the time of day (b) the battery level (c) the page title (d) the screen width
  16. 16.🎯 What kind of selector is .big? (a) a class selector (b) an id selector (c) an element selector
  17. 17.⚖️ Which selector is the weakest? (a) an element selector (b) an id selector (c) a class selector
  18. 18.📦 In the box model, which part is space inside the border? (a) padding (b) border (c) margin (d) content
  19. 19.🎯 Which element does the selector #end style? (a) <h2 id="end"> (b) <h2 class="end"> (c) <li class="big"> (d) <h2 id="hero">
  20. 20.📦 In the box model, which part is space outside the border? (a) padding (b) content (c) border (d) margin
  21. 21.True or false: #hero is a class selector. (a) False (b) True
  22. 22.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 100px;
      padding: 10px;
      border: 5px solid black;
      margin: 10px;
    }
  23. 23.True or false: JavaScript adds space around boxes. (a) True (b) False
  24. 24.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 6 (b) 4 (c) 3 (d) 2
  25. 25.⚖️ What colour is the text of this element?
    <p class="box" id="hero">Hi</p>
    CSS:
    .box { color: white; }
    .box { color: black; }
    (a) blue (b) black (c) white (d) purple
  26. 26.💪 Which flexbox property lines boxes up across? (a) display: flex (b) flex-direction (c) justify-content (d) align-items
  27. 27.✍️ How many declarations (property: value pairs) are in this rule?
    body {
      margin: 10px;
      border: 2px solid;
    }
  28. 28.🎯 Can many elements share the same class? (a) No (b) Yes
  29. 29.🎯 Which element does the selector .box style? (a) <h2 class="box"> (b) <h2 class="star"> (c) <li class="menu"> (d) <h2 id="box">
  30. 30.🎯 What kind of selector is .note? (a) a class selector (b) an element selector (c) an id selector
  31. 31.🎯 Which element does the selector .box style? (a) <h1 class="menu"> (b) <p class="star"> (c) <p class="box"> (d) <p id="box">
  32. 32.🔍 Which is the odd one out? (a) makes headings and lists (b) lays out the page (c) sets colours and fonts (d) changes the text size
  33. 33.🖌️ What colour is behind the letters?
    h2 {
      text-align: center;
      color: purple;
      background-color: green;
      font-size: 12px;
    }
    (a) purple (b) red (c) green
  34. 34.🖌️ Where does the text sit on its line?
    h1 {
      background-color: yellow;
      font-size: 16px;
      text-align: right;
      color: black;
    }
    (a) on the left (b) in the middle (c) on the right
  35. 35.✍️ CSS declarations go inside which brackets? (a) { } (b) ( ) (c) [ ] (d) < >
  36. 36.🌈 Hex digits go 0 to 9, then A to which letter? (a) Z (b) F (c) J (d) G
  37. 37.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 200px;
      justify-content: center;
    }
    Inside are 3 boxes, each 40px wide (no margins).
  38. 38.🔍 Which is the odd one out? (a) changes the page live (b) adds space around boxes (c) counts down a timer (d) checks a quiz answer
  39. 39.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 500px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 80px wide (no margins).
  40. 40.✍️ Which property is set to 20px in this rule?
    h2 {
      background-color: yellow;
      font-size: 20px;
    }
    (a) background-color (b) 20px (c) text-align (d) font-size

Answer key

  1. 20
  2. orange
  3. False
  4. blue
  5. body
  6. rounds box corners
  7. yellow
  8. JavaScript
  9. center
  10. packs boxes at the end
  11. puts a picture on a page
  12. red
  13. black
  14. ;
  15. the screen width
  16. a class selector
  17. an element selector
  18. padding
  19. <h2 id="end">
  20. margin
  21. False
  22. 150
  23. False
  24. 3
  25. black
  26. align-items
  27. 2
  28. Yes
  29. <h2 class="box">
  30. a class selector
  31. <p class="box">
  32. makes headings and lists
  33. green
  34. on the right
  35. { }
  36. F
  37. 40
  38. adds space around boxes
  39. 60
  40. font-size

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