← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 764 · 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 CSS property centres a heading? (a) font-weight (b) background-color (c) color (d) text-align
  2. 2.🌈 Which colour is #0000ff? (a) blue (b) magenta (c) yellow (d) cyan
  3. 3.What does color do? (a) makes the text bold (b) makes letters bigger (c) sets the letter colour (d) centres a heading
  4. 4.🎨 One CSS file can style how many pages? (a) no pages (b) only one image (c) many pages (d) only one word
  5. 5.What does justify-content: center do? (a) packs boxes at the start (b) puts boxes in the middle (c) equal gaps, none at ends (d) packs boxes at the end
  6. 6.🎯 Which CSS selector matches this element?
    <p class="box" id="end">Hello</p>
    (a) #box (b) h1 (c) #end (d) #hero
  7. 7.💪 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 40px wide (no margins).
  8. 8.🖌️ How big is the text, in px?
    h2 {
      color: blue;
      text-align: left;
      background-color: yellow;
      font-size: 32px;
    }
  9. 9.🎯 Which element does the selector li style? (a) <div> (b) <p id="main"> (c) <li class="big"> (d) <span class="big">
  10. 10.⚖️ What colour is the text of this element?
    <h2 class="red" id="hero">Hi</h2>
    CSS:
    h2 { color: black; }
    h2 { color: blue; }
    (a) blue (b) orange (c) black (d) white
  11. 11.🎨 Which tag holds CSS inside the head? (a) <css> (b) <style> (c) <body> (d) <script>
  12. 12.✍️ What value is given to border in this rule?
    h2 {
      text-align: center;
      border: 2px solid;
    }
    (a) italic (b) 2px solid (c) 300px (d) border
  13. 13.⚖️ What colour is the text of this element?
    <h1 class="note" id="intro">Hi</h1>
    CSS:
    #intro { color: yellow; }
    h1 { color: orange; }
    .note { color: black; }
    (a) yellow (b) purple (c) black (d) orange
  14. 14.Which of these does JavaScript do? (a) changes the page live (b) makes headings and lists (c) rounds box corners (d) makes a form box
  15. 15.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 28px;
      }
    }
  16. 16.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 22px;
      }
    }
  17. 17.What does font-weight do? (a) makes the text bold (b) colours behind the text (c) centres a heading (d) picks the font style
  18. 18.📦 In the box model, which part is a solid or dotted edge? (a) padding (b) content (c) margin (d) border
  19. 19.🖌️ Which CSS property picks the font style? (a) text-align (b) font-weight (c) font-family (d) background-color
  20. 20.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 160px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 50px wide (no margins).
  21. 21.⚖️ What colour is the text of this element?
    <h2 class="note" id="intro">Hi</h2>
    CSS:
    h2 { color: yellow; }
    h2 { color: purple; }
    (a) yellow (b) red (c) purple (d) black
  22. 22.Which of these does HTML do? (a) changes the text size (b) makes a form box (c) lays out the page (d) sets colours and fonts
  23. 23.Which of these does JavaScript do? (a) gives the page structure (b) makes a link (c) counts down a timer (d) puts a picture on a page
  24. 24.What does justify-content: flex-start 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
  25. 25.🌈 Which colour is rgb(255, 0, 0)? (a) yellow (b) black (c) cyan (d) red
  26. 26.True or false: img is an id selector. (a) True (b) False
  27. 27.🎯 Which CSS selector matches this element?
    <h2 class="note" id="intro">Hello</h2>
    (a) .big (b) #intro (c) li (d) #note
  28. 28.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 140px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  29. 29.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 8px;
      }
    }
    (a) Yes (b) No
  30. 30.🖌️ What colour is behind the letters?
    li {
      color: red;
      background-color: blue;
      text-align: right;
      font-size: 16px;
    }
    (a) red (b) yellow (c) blue
  31. 31.True or false: the border is a solid or dotted edge. (a) False (b) True
  32. 32.🧩 Which language sets colours and fonts? (a) JavaScript (b) CSS (c) HTML
  33. 33.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      background-color: yellow;
      color: red;
    }
  34. 34.⚖️ What colour is the text of this element?
    <h1 class="star" id="end">Hi</h1>
    CSS:
    h1 { color: white; }
    h1 { color: yellow; }
    (a) white (b) red (c) purple (d) yellow
  35. 35.🎯 What kind of selector is .menu? (a) an element selector (b) an id selector (c) a class selector
  36. 36.🌈 In #5d0000 the red part is the hex number 5d. What is it as a normal number?
  37. 37.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 14px;
      }
    }
    (a) No (b) Yes
  38. 38.🌈 Which colour of light is strongest in rgb(74, 229, 102)? (a) red (b) blue (c) green
  39. 39.🖌️ What colour is behind the letters?
    p {
      color: red;
      text-align: left;
      font-size: 32px;
      background-color: white;
    }
    (a) red (b) white (c) yellow
  40. 40.🌈 Hex digits go 0 to 9, then A to which letter? (a) G (b) F (c) J (d) Z

Answer key

  1. text-align
  2. blue
  3. sets the letter colour
  4. many pages
  5. puts boxes in the middle
  6. #end
  7. 60
  8. 32
  9. <li class="big">
  10. blue
  11. <style>
  12. 2px solid
  13. yellow
  14. changes the page live
  15. 24
  16. 20
  17. makes the text bold
  18. border
  19. font-family
  20. 10
  21. purple
  22. makes a form box
  23. counts down a timer
  24. packs boxes at the start
  25. red
  26. False
  27. #intro
  28. 20
  29. Yes
  30. blue
  31. True
  32. CSS
  33. 2
  34. yellow
  35. a class selector
  36. 93
  37. Yes
  38. green
  39. white
  40. F

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