← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 378 · 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 is the odd one out? (a) reacts to a button click (b) shows a pop-up message (c) rounds box corners (d) checks a quiz answer
  2. 2.🌈 Which colour is #00ff00? (a) white (b) magenta (c) blue (d) bright green
  3. 3.🌈 Which hex code is cyan? (a) #ffff00 (b) #00ffff (c) #000000 (d) #00ff00
  4. 4.What does font-weight do? (a) colours behind the text (b) picks the font style (c) sets the letter colour (d) makes the text bold
  5. 5.🎯 What kind of selector is .menu? (a) an element selector (b) a class selector (c) an id selector
  6. 6.🌈 In #rrggbb, which colour do the last two digits give? (a) red (b) blue (c) green (d) white
  7. 7.What does font-size do? (a) colours behind the text (b) centres a heading (c) makes letters bigger (d) sets the letter colour
  8. 8.True or false: JavaScript sets colours and fonts. (a) True (b) False
  9. 9.🎯 Which element does the selector li style? (a) <span class="note"> (b) <li class="note"> (c) <p id="top"> (d) <div>
  10. 10.🖌️ Which CSS property colours behind the text? (a) background-color (b) font-size (c) text-align (d) font-weight
  11. 11.⚖️ Which selector is the weakest? (a) an id selector (b) a class selector (c) an element selector
  12. 12.⚖️ Which selector is the strongest? (a) a class selector (b) an element selector (c) an id selector
  13. 13.🎨 Which tag holds CSS inside the head? (a) <body> (b) <style> (c) <script> (d) <css>
  14. 14.True or false: JavaScript lays out the page. (a) False (b) True
  15. 15.🖌️ What colour is behind the letters?
    h1 {
      text-align: center;
      background-color: yellow;
      color: blue;
      font-size: 16px;
    }
    (a) yellow (b) purple (c) blue
  16. 16.✍️ In color: blue; which part is the property? (a) color (b) : (c) blue (d) ;
  17. 17.✍️ CSS declarations go inside which brackets? (a) { } (b) < > (c) ( ) (d) [ ]
  18. 18.✍️ What is the selector in this CSS rule?
    body {
      text-align: center;
      color: red;
    }
    (a) red (b) .box (c) body (d) text-align
  19. 19.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 50px;
      padding: 15px;
      border: 1px solid black;
      margin: 20px;
    }
  20. 20.💪 Which justify-content value packs boxes at the start? (a) center (b) flex-end (c) flex-start (d) space-between
  21. 21.🎨 A CSS file usually ends with which extension? (a) .js (b) .png (c) .html (d) .css
  22. 22.🌈 Which colour of light is strongest in rgb(206, 49, 128)? (a) blue (b) green (c) red
  23. 23.🔍 Which is the odd one out? (a) counts down a timer (b) makes headings and lists (c) shows a pop-up message (d) reacts to a button click
  24. 24.True or false: margin is the gap round content. (a) True (b) False
  25. 25.🔍 Which is the odd one out? (a) changes the page live (b) puts a picture on a page (c) gives the page structure (d) makes a form box
  26. 26.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 260px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  27. 27.✍️ How does a CSS comment start? (a) <!-- (b) /* (c) # (d) //
  28. 28.⚖️ What colour is the text of this element?
    <h1 class="box" id="end">Hi</h1>
    CSS:
    h1 { color: yellow; }
    .box { color: red; }
    (a) black (b) white (c) yellow (d) red
  29. 29.⚖️ What colour is the text of this element?
    <p class="big" id="top">Hi</p>
    CSS:
    .big { color: black; }
    p { color: blue; }
    (a) blue (b) yellow (c) purple (d) black
  30. 30.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 20px;
      }
    }
    (a) No (b) Yes
  31. 31.True or false: CSS rounds box corners. (a) False (b) True
  32. 32.⚖️ What colour is the text of this element?
    <h2 class="red" id="hero">Hi</h2>
    CSS:
    .red { color: white; }
    .red { color: yellow; }
    (a) orange (b) white (c) yellow (d) red
  33. 33.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 8px;
      }
    }
  34. 34.🖌️ Which CSS property sets the letter colour? (a) text-align (b) color (c) background-color (d) font-family
  35. 35.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 100px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  36. 36.📦 In the box model, which part is space inside the border? (a) content (b) border (c) margin (d) padding
  37. 37.True or false: the border is the line round the box. (a) True (b) False
  38. 38.True or false: #hero is an id selector. (a) True (b) False
  39. 39.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 8px;
      }
    }
  40. 40.🖌️ Where does the text sit on its line?
    p {
      background-color: white;
      text-align: right;
      font-size: 24px;
      color: yellow;
    }
    (a) on the right (b) in the middle (c) on the left

Answer key

  1. rounds box corners
  2. bright green
  3. #00ffff
  4. makes the text bold
  5. a class selector
  6. blue
  7. makes letters bigger
  8. False
  9. <li class="note">
  10. background-color
  11. an element selector
  12. an id selector
  13. <style>
  14. False
  15. yellow
  16. color
  17. { }
  18. body
  19. 122
  20. flex-start
  21. .css
  22. red
  23. makes headings and lists
  24. False
  25. changes the page live
  26. 60
  27. /*
  28. red
  29. black
  30. No
  31. True
  32. yellow
  33. 12
  34. color
  35. 20
  36. padding
  37. True
  38. True
  39. 8
  40. on the right

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