← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 14 · 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. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 28px;
      }
    }
    (a) Yes (b) No
  2. 2.🖌️ What colour is behind the letters?
    li {
      background-color: green;
      color: purple;
      text-align: center;
      font-size: 40px;
    }
    (a) green (b) purple (c) orange
  3. 3.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 70px;
      padding: 30px;
      border: 1px solid black;
      margin: 0px;
    }
  4. 4.🔍 Which is the odd one out? (a) makes a link (b) puts a picture on a page (c) makes a form box (d) changes the text size
  5. 5.🖌️ Which CSS property picks the font style? (a) color (b) background-color (c) font-family (d) font-weight
  6. 6.💪 Which justify-content value equal gaps, none at ends? (a) space-between (b) flex-start (c) flex-end (d) center
  7. 7.🎯 Which element does the selector #end style? (a) <span class="red"> (b) <div id="hero"> (c) <div class="end"> (d) <div id="end">
  8. 8.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 300px;
      justify-content: center;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  9. 9.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 14px;
      }
    }
    (a) Yes (b) No
  10. 10.🖌️ Where does the text sit on its line?
    p {
      color: yellow;
      text-align: right;
      background-color: blue;
      font-size: 32px;
    }
    (a) in the middle (b) on the left (c) on the right
  11. 11.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 32px;
      }
    }
    (a) No (b) Yes
  12. 12.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 260px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  13. 13.⚖️ What colour is the text of this element?
    <p class="star" id="main">Hi</p>
    CSS:
    p { color: white; }
    #main { color: purple; }
    .star { color: red; }
    (a) orange (b) purple (c) white (d) red
  14. 14.⚖️ Which selector is the weakest? (a) a class selector (b) an element selector (c) an id selector
  15. 15.🖌️ What colour is behind the letters?
    h2 {
      color: red;
      font-size: 40px;
      background-color: black;
      text-align: left;
    }
    (a) red (b) purple (c) black
  16. 16.🖌️ Which CSS property sets the letter colour? (a) font-size (b) color (c) text-align (d) font-weight
  17. 17.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 220px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  18. 18.True or false: JavaScript adds space around boxes. (a) False (b) True
  19. 19.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) exactly 100px (c) turned off (d) 800px or wider
  20. 20.🧩 Which language lays out the page? (a) JavaScript (b) CSS (c) HTML
  21. 21.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 18px;
      }
    }
  22. 22.🌈 In #rrggbb, which colour do the first two digits give? (a) green (b) blue (c) black (d) red
  23. 23.⚖️ What colour is the text of this element?
    <p class="star" id="top">Hi</p>
    CSS:
    p { color: green; }
    p { color: white; }
    (a) blue (b) green (c) red (d) white
  24. 24.✍️ What is the selector in this CSS rule?
    .note {
      background-color: yellow;
      color: red;
      border: 2px solid;
    }
    (a) #top (b) .note (c) background-color (d) red
  25. 25.✍️ CSS declarations go inside which brackets? (a) ( ) (b) { } (c) [ ] (d) < >
  26. 26.Which of these does HTML do? (a) changes the text size (b) sets colours and fonts (c) puts a picture on a page (d) checks a quiz answer
  27. 27.What does justify-content: center do? (a) puts boxes in the middle (b) packs boxes at the end (c) packs boxes at the start (d) equal gaps, none at ends
  28. 28.✍️ In color: blue; which part is the value? (a) : (b) ; (c) blue (d) color
  29. 29.🎯 Which element does the selector h2 style? (a) <div class="big"> (b) <li> (c) <span id="top"> (d) <h2 class="big">
  30. 30.🌈 Which colour is #0000ff? (a) yellow (b) white (c) blue (d) cyan
  31. 31.🎯 Can many elements share the same class? (a) No (b) Yes
  32. 32.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 160px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  33. 33.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 12px;
      }
    }
  34. 34.🎯 Which element does the selector .menu style? (a) <div class="big"> (b) <li class="menu"> (c) <li id="menu"> (d) <li class="note">
  35. 35.🌈 Which colour is rgb(255, 255, 255)? (a) bright green (b) red (c) magenta (d) white
  36. 36.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      color: red;
      font-size: 20px;
    }
  37. 37.📱 What does a media query check? (a) the battery level (b) the time of day (c) the screen width (d) the page title
  38. 38.✍️ What is the selector in this CSS rule?
    body {
      background-color: yellow;
      color: red;
      border: 2px solid;
      font-size: 20px;
    }
    (a) background-color (b) body (c) red (d) .box
  39. 39.⚖️ Which selector is the strongest? (a) an id selector (b) an element selector (c) a class selector
  40. 40.📦 In the box model, which part is a solid or dotted edge? (a) margin (b) content (c) border (d) padding

Answer key

  1. Yes
  2. green
  3. 132
  4. changes the text size
  5. font-family
  6. space-between
  7. <div id="end">
  8. 50
  9. No
  10. on the right
  11. Yes
  12. 20
  13. purple
  14. an element selector
  15. black
  16. color
  17. 20
  18. False
  19. 800px or wider
  20. CSS
  21. 16
  22. red
  23. white
  24. .note
  25. { }
  26. puts a picture on a page
  27. puts boxes in the middle
  28. blue
  29. <h2 class="big">
  30. blue
  31. Yes
  32. 80
  33. 16
  34. <li class="menu">
  35. white
  36. 2
  37. the screen width
  38. body
  39. an id selector
  40. border

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