← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 242 · 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 colour is the text of this element?
    <p class="note" id="main">Hi</p>
    CSS:
    .note { color: blue; }
    .note { color: green; }
    (a) green (b) orange (c) red (d) blue
  2. 2.🌈 Which colour of light is strongest in rgb(221, 23, 74)? (a) blue (b) red (c) green
  3. 3.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 8px;
      }
    }
  4. 4.⚖️ What colour is the text of this element?
    <p class="star" id="end">Hi</p>
    CSS:
    .star { color: white; }
    .star { color: black; }
    (a) black (b) white (c) blue (d) orange
  5. 5.🎯 What kind of selector is #logo? (a) a class selector (b) an element selector (c) an id selector
  6. 6.⚖️ What colour is the text of this element?
    <h2 class="menu" id="hero">Hi</h2>
    CSS:
    #hero { color: red; }
    h2 { color: white; }
    (a) orange (b) red (c) purple (d) white
  7. 7.⚖️ What colour is the text of this element?
    <h1 class="note" id="end">Hi</h1>
    CSS:
    #end { color: white; }
    h1 { color: red; }
    .note { color: blue; }
    (a) white (b) black (c) blue (d) red
  8. 8.🧩 Which language makes a form box? (a) CSS (b) HTML (c) JavaScript
  9. 9.🖌️ What colour is behind the letters?
    li {
      background-color: purple;
      text-align: right;
      font-size: 24px;
      color: green;
    }
    (a) purple (b) yellow (c) green
  10. 10.💪 Which justify-content value packs boxes at the end? (a) flex-start (b) flex-end (c) center (d) space-between
  11. 11.🎯 Which CSS selector matches this element?
    <p class="red" id="logo">Hello</p>
    (a) #red (b) .box (c) .logo (d) #logo
  12. 12.⚖️ Which selector is the strongest? (a) an element selector (b) an id selector (c) a class selector
  13. 13.✍️ What value is given to color in this rule?
    .note {
      font-style: italic;
      text-align: center;
      color: red;
      font-weight: bold;
    }
    (a) 20px (b) red (c) color (d) center
  14. 14.🌈 Which colour is rgb(255, 255, 0)? (a) white (b) yellow (c) blue (d) magenta
  15. 15.🖌️ What colour are the letters?
    p {
      font-size: 20px;
      text-align: left;
      background-color: red;
      color: green;
    }
    (a) black (b) green (c) red
  16. 16.🔍 Which is the odd one out? (a) makes a form box (b) makes a link (c) changes the text size (d) puts a picture on a page
  17. 17.🎯 Which element does the selector #intro style? (a) <p class="box"> (b) <span id="main"> (c) <span id="intro"> (d) <span class="intro">
  18. 18.⚖️ What colour is the text of this element?
    <h1 class="star" id="hero">Hi</h1>
    CSS:
    #hero { color: yellow; }
    h1 { color: black; }
    .star { color: orange; }
    (a) red (b) yellow (c) orange (d) black
  19. 19.🔍 Which is the odd one out? (a) changes the page live (b) puts a picture on a page (c) checks a quiz answer (d) counts down a timer
  20. 20.📱 The screen is 1366px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 24px;
      }
    }
    (a) Yes (b) No
  21. 21.🧩 Which language puts a picture on a page? (a) CSS (b) HTML (c) JavaScript
  22. 22.🌈 Which colour is rgb(0, 255, 255)? (a) bright green (b) cyan (c) red (d) blue
  23. 23.True or false: HTML makes headings and lists. (a) False (b) True
  24. 24.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 380px;
      justify-content: flex-end;
    }
    Inside are 3 boxes, each 100px wide (no margins).
  25. 25.💪 Which flexbox property lines boxes up across? (a) flex-direction (b) display: flex (c) align-items (d) gap
  26. 26.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      font-weight: bold;
    }
  27. 27.✍️ CSS declarations go inside which brackets? (a) ( ) (b) { } (c) < > (d) [ ]
  28. 28.🖌️ What colour are the letters?
    h1 {
      font-size: 20px;
      text-align: left;
      color: blue;
      background-color: orange;
    }
    (a) orange (b) purple (c) blue
  29. 29.✍️ What value is given to text-align in this rule?
    h2 {
      font-size: 20px;
      font-style: italic;
      text-align: center;
      width: 300px;
    }
    (a) 10px (b) center (c) text-align (d) yellow
  30. 30.🌈 What is the biggest number one colour can have in rgb()? (a) 100 (b) 255 (c) 1000 (d) 99
  31. 31.🔍 Which is the odd one out? (a) makes headings and lists (b) shows a pop-up message (c) makes a link (d) gives the page structure
  32. 32.✍️ What is the selector in this CSS rule?
    li {
      width: 300px;
      font-size: 20px;
      font-weight: bold;
    }
    (a) body (b) 20px (c) li (d) width
  33. 33.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 20px;
      }
    }
    (a) No (b) Yes
  34. 34.📦 In the box model, which part is space inside the border? (a) padding (b) border (c) margin (d) content
  35. 35.🎨 Which tag holds CSS inside the head? (a) <script> (b) <css> (c) <style> (d) <body>
  36. 36.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 90px;
      padding: 10px;
      border: 2px solid black;
      margin: 20px;
    }
  37. 37.📱 Responsive design means a page ___. (a) has no pictures (b) never changes (c) is only for laptops (d) fits every screen
  38. 38.True or false: the content is a solid or dotted edge. (a) True (b) False
  39. 39.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 260px;
      padding: 15px;
      border: 1px solid black;
      margin: 5px;
    }
  40. 40.🖌️ Which CSS property makes letters bigger? (a) background-color (b) font-weight (c) text-align (d) font-size

Answer key

  1. green
  2. red
  3. 12
  4. black
  5. an id selector
  6. red
  7. white
  8. HTML
  9. purple
  10. flex-end
  11. #logo
  12. an id selector
  13. red
  14. yellow
  15. green
  16. changes the text size
  17. <span id="intro">
  18. yellow
  19. puts a picture on a page
  20. Yes
  21. HTML
  22. cyan
  23. True
  24. 80
  25. align-items
  26. 1
  27. { }
  28. blue
  29. center
  30. 255
  31. shows a pop-up message
  32. li
  33. Yes
  34. padding
  35. <style>
  36. 154
  37. fits every screen
  38. False
  39. 292
  40. font-size

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