← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 721 · 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 selector is the weakest? (a) an id selector (b) a class selector (c) an element selector
  2. 2.🖌️ What colour is behind the letters?
    h2 {
      font-size: 36px;
      background-color: purple;
      color: yellow;
      text-align: center;
    }
    (a) yellow (b) green (c) purple
  3. 3.🖌️ What colour is behind the letters?
    p {
      background-color: blue;
      font-size: 28px;
      text-align: left;
      color: red;
    }
    (a) red (b) green (c) blue
  4. 4.✍️ How many declarations (property: value pairs) are in this rule?
    .box {
      border: 2px solid;
      color: red;
      text-align: center;
    }
  5. 5.⚖️ What colour is the text of this element?
    <h1 class="big" id="top">Hi</h1>
    CSS:
    .big { color: white; }
    .big { color: green; }
    (a) white (b) green (c) purple (d) yellow
  6. 6.💪 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 50px wide (no margins).
  7. 7.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 270px;
      padding: 10px;
      border: 1px solid black;
      margin: 10px;
    }
  8. 8.⚖️ What colour is the text of this element?
    <p class="menu" id="top">Hi</p>
    CSS:
    #top { color: white; }
    .menu { color: blue; }
    (a) yellow (b) black (c) white (d) blue
  9. 9.🌈 Which colour is #ff0000? (a) magenta (b) black (c) red (d) white
  10. 10.⚖️ What colour is the text of this element?
    <h2 class="star" id="intro">Hi</h2>
    CSS:
    .star { color: green; }
    h2 { color: red; }
    (a) orange (b) yellow (c) red (d) green
  11. 11.🌈 In #00000a the blue part is the hex number 0a. What is it as a normal number?
  12. 12.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 6 (b) 3 (c) 4 (d) 2
  13. 13.⚖️ What colour is the text of this element?
    <p class="star" id="end">Hi</p>
    CSS:
    .star { color: orange; }
    .star { color: yellow; }
    (a) green (b) black (c) orange (d) yellow
  14. 14.🖌️ Which CSS property centres a heading? (a) text-align (b) color (c) font-size (d) font-family
  15. 15.💪 Which justify-content value packs boxes at the start? (a) flex-end (b) center (c) space-between (d) flex-start
  16. 16.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 26px;
      }
    }
    (a) Yes (b) No
  17. 17.📱 Responsive design means a page ___. (a) has no pictures (b) fits every screen (c) is only for laptops (d) never changes
  18. 18.🖌️ What colour is behind the letters?
    h2 {
      text-align: left;
      background-color: orange;
      color: black;
      font-size: 16px;
    }
    (a) yellow (b) orange (c) black
  19. 19.⚖️ What colour is the text of this element?
    <p class="note" id="end">Hi</p>
    CSS:
    .note { color: blue; }
    .note { color: white; }
    (a) blue (b) green (c) white (d) red
  20. 20.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 150px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  21. 21.🧩 Which language changes the page live? (a) CSS (b) HTML (c) JavaScript
  22. 22.🌈 Which colour is #ff00ff? (a) yellow (b) white (c) red (d) magenta
  23. 23.✍️ How does a CSS comment start? (a) <!-- (b) /* (c) // (d) #
  24. 24.Which of these does JavaScript do? (a) gives the page structure (b) adds space around boxes (c) puts a picture on a page (d) changes the page live
  25. 25.⚖️ What colour is the text of this element?
    <p class="big" id="end">Hi</p>
    CSS:
    p { color: orange; }
    .big { color: green; }
    (a) orange (b) black (c) green (d) blue
  26. 26.🌈 Which colour is #0000ff? (a) red (b) blue (c) yellow (d) black
  27. 27.⚖️ What colour is the text of this element?
    <h2 class="menu" id="end">Hi</h2>
    CSS:
    #end { color: red; }
    #end { color: blue; }
    (a) blue (b) purple (c) green (d) red
  28. 28.⚖️ What colour is the text of this element?
    <p class="red" id="end">Hi</p>
    CSS:
    #end { color: orange; }
    .red { color: purple; }
    (a) blue (b) orange (c) purple (d) yellow
  29. 29.💪 Which flexbox property picks row or column? (a) align-items (b) display: flex (c) flex-direction (d) justify-content
  30. 30.🌈 Which colour is #00ffff? (a) magenta (b) cyan (c) bright green (d) red
  31. 31.✍️ How many declarations (property: value pairs) are in this rule?
    body {
      font-style: italic;
    }
  32. 32.Which of these is margin? (a) space inside the border (b) space outside the border (c) the line round the box (d) the text or picture
  33. 33.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 110px;
      padding: 10px;
      border: 3px solid black;
      margin: 10px;
    }
  34. 34.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 8px;
      }
    }
    (a) No (b) Yes
  35. 35.What does background-color do? (a) colours behind the text (b) sets the letter colour (c) centres a heading (d) picks the font style
  36. 36.🔍 Which is the odd one out? (a) changes the text size (b) lays out the page (c) sets colours and fonts (d) makes a form box
  37. 37.⚖️ What colour is the text of this element?
    <h2 class="star" id="hero">Hi</h2>
    CSS:
    #hero { color: blue; }
    h2 { color: white; }
    .star { color: yellow; }
    (a) green (b) blue (c) yellow (d) white
  38. 38.🔍 Which is the odd one out? (a) rounds box corners (b) sets colours and fonts (c) changes the page live (d) lays out the page
  39. 39.✍️ What value is given to margin in this rule?
    .note {
      background-color: yellow;
      margin: 10px;
    }
    (a) margin (b) 8px (c) 10px (d) bold
  40. 40.📦 In the box model, which part is the gap round content? (a) margin (b) border (c) content (d) padding

Answer key

  1. an element selector
  2. purple
  3. blue
  4. 3
  5. green
  6. 70
  7. 312
  8. white
  9. red
  10. green
  11. 10
  12. 3
  13. yellow
  14. text-align
  15. flex-start
  16. Yes
  17. fits every screen
  18. orange
  19. white
  20. 30
  21. JavaScript
  22. magenta
  23. /*
  24. changes the page live
  25. green
  26. blue
  27. blue
  28. orange
  29. flex-direction
  30. cyan
  31. 1
  32. space outside the border
  33. 156
  34. Yes
  35. colours behind the text
  36. makes a form box
  37. blue
  38. changes the page live
  39. 10px
  40. padding

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