← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 582 · 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 kind of selector is .big? (a) an element selector (b) an id selector (c) a class selector
  2. 2.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 420px;
      justify-content: space-between;
    }
    Inside are 3 boxes, each 100px wide (no margins).
  3. 3.🌈 Which colour is #00ffff? (a) red (b) cyan (c) yellow (d) magenta
  4. 4.⚖️ What colour is the text of this element?
    <p class="box" id="hero">Hi</p>
    CSS:
    #hero { color: yellow; }
    #hero { color: purple; }
    (a) yellow (b) purple (c) blue (d) black
  5. 5.🎯 Which CSS selector matches this element?
    <h1 class="menu" id="end">Hello</h1>
    (a) #hero (b) .note (c) h2 (d) .menu
  6. 6.🎯 What kind of selector is .star? (a) an id selector (b) an element selector (c) a class selector
  7. 7.🔍 Which is the odd one out? (a) reacts to a button click (b) makes a form box (c) changes the page live (d) checks a quiz answer
  8. 8.⚖️ What colour is the text of this element?
    <p class="red" id="intro">Hi</p>
    CSS:
    p { color: red; }
    p { color: purple; }
    (a) green (b) red (c) purple (d) black
  9. 9.Which of these does HTML do? (a) changes the page live (b) reacts to a button click (c) adds space around boxes (d) gives the page structure
  10. 10.💪 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 40px wide (no margins).
  11. 11.📱 max-width: 600px applies when the screen is ___. (a) 600px or narrower (b) turned off (c) exactly 1000px (d) 600px or wider
  12. 12.🌈 In #rrggbb, which colour do the last two digits give? (a) red (b) white (c) blue (d) green
  13. 13.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 22px;
      }
    }
    (a) Yes (b) No
  14. 14.⚖️ What colour is the text of this element?
    <h2 class="menu" id="end">Hi</h2>
    CSS:
    h2 { color: red; }
    h2 { color: orange; }
    (a) white (b) orange (c) purple (d) red
  15. 15.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 260px;
      padding: 25px;
      border: 1px solid black;
      margin: 15px;
    }
  16. 16.⚖️ What colour is the text of this element?
    <p class="menu" id="logo">Hi</p>
    CSS:
    #logo { color: white; }
    #logo { color: red; }
    (a) orange (b) white (c) black (d) red
  17. 17.📦 In the box model, which part is the text or picture? (a) border (b) content (c) margin (d) padding
  18. 18.💪 Which flexbox property turns on flexbox? (a) display: flex (b) gap (c) align-items (d) justify-content
  19. 19.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 18px;
      }
    }
  20. 20.⚖️ Which selector is the weakest? (a) an id selector (b) an element selector (c) a class selector
  21. 21.✍️ Which property is set to italic in this rule?
    .note {
      text-align: center;
      padding: 8px;
      font-size: 20px;
      font-style: italic;
    }
    (a) italic (b) font-style (c) color (d) font-size
  22. 22.Which of these does CSS do? (a) puts a picture on a page (b) counts down a timer (c) adds space around boxes (d) reacts to a button click
  23. 23.⚖️ What colour is the text of this element?
    <h1 class="box" id="logo">Hi</h1>
    CSS:
    #logo { color: blue; }
    .box { color: purple; }
    (a) blue (b) yellow (c) green (d) purple
  24. 24.🔍 Which is the odd one out? (a) checks a quiz answer (b) changes the page live (c) reacts to a button click (d) changes the text size
  25. 25.Which of these does CSS do? (a) puts a picture on a page (b) makes a form box (c) sets colours and fonts (d) changes the page live
  26. 26.True or false: JavaScript checks a quiz answer. (a) False (b) True
  27. 27.🎯 Which element does the selector h2 style? (a) <div class="box"> (b) <span id="main"> (c) <li> (d) <h2 class="box">
  28. 28.✍️ How does a CSS comment start? (a) /* (b) <!-- (c) # (d) //
  29. 29.🌈 In #680000 the red part is the hex number 68. What is it as a normal number?
  30. 30.True or false: the content is the text or picture. (a) False (b) True
  31. 31.⚖️ What colour is the text of this element?
    <h1 class="star" id="logo">Hi</h1>
    CSS:
    .star { color: green; }
    h1 { color: red; }
    (a) purple (b) red (c) yellow (d) green
  32. 32.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 220px;
      justify-content: space-between;
    }
    Inside are 3 boxes, each 60px wide (no margins).
  33. 33.⚖️ What colour is the text of this element?
    <p class="big" id="logo">Hi</p>
    CSS:
    p { color: blue; }
    p { color: red; }
    (a) blue (b) yellow (c) red (d) orange
  34. 34.✍️ Which property is set to center in this rule?
    #top {
      border: 2px solid;
      text-align: center;
    }
    (a) center (b) background-color (c) margin (d) text-align
  35. 35.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 280px;
      padding: 5px;
      border: 1px solid black;
      margin: 10px;
    }
  36. 36.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 170px;
      padding: 30px;
      border: 3px solid black;
      margin: 15px;
    }
  37. 37.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 10px;
      }
    }
    (a) Yes (b) No
  38. 38.🖌️ How big is the text, in px?
    h2 {
      background-color: white;
      font-size: 40px;
      color: red;
      text-align: right;
    }
  39. 39.🧩 Which language lays out the page? (a) HTML (b) CSS (c) JavaScript
  40. 40.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 270px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 60px wide (no margins).

Answer key

  1. a class selector
  2. 60
  3. cyan
  4. purple
  5. .menu
  6. a class selector
  7. makes a form box
  8. purple
  9. gives the page structure
  10. 40
  11. 600px or narrower
  12. blue
  13. Yes
  14. orange
  15. 342
  16. red
  17. content
  18. display: flex
  19. 20
  20. an element selector
  21. font-style
  22. adds space around boxes
  23. blue
  24. changes the text size
  25. sets colours and fonts
  26. True
  27. <h2 class="box">
  28. /*
  29. 104
  30. True
  31. green
  32. 20
  33. red
  34. text-align
  35. 312
  36. 266
  37. Yes
  38. 40
  39. CSS
  40. 30

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