← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 822 · 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 does justify-content: flex-start do? (a) puts boxes in the middle (b) packs boxes at the start (c) equal gaps, none at ends (d) packs boxes at the end
  2. 2.⚖️ What colour is the text of this element?
    <p class="big" id="end">Hi</p>
    CSS:
    p { color: blue; }
    #end { color: white; }
    .big { color: yellow; }
    (a) yellow (b) blue (c) red (d) white
  3. 3.📦 In the box model, which part is space outside the border? (a) margin (b) content (c) padding (d) border
  4. 4.🔍 Which is the odd one out? (a) lays out the page (b) rounds box corners (c) changes the text size (d) makes headings and lists
  5. 5.🖌️ How big is the text, in px?
    li {
      background-color: white;
      font-size: 24px;
      text-align: left;
      color: yellow;
    }
  6. 6.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 120px;
      padding: 15px;
      border: 1px solid black;
      margin: 10px;
    }
  7. 7.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 220px;
      justify-content: center;
    }
    Inside are 2 boxes, each 80px wide (no margins).
  8. 8.⚖️ What colour is the text of this element?
    <h1 class="note" id="intro">Hi</h1>
    CSS:
    #intro { color: orange; }
    #intro { color: blue; }
    (a) yellow (b) blue (c) black (d) orange
  9. 9.📱 What does a media query check? (a) the screen width (b) the battery level (c) the page title (d) the time of day
  10. 10.True or false: JavaScript shows a pop-up message. (a) True (b) False
  11. 11.🔍 Which is the odd one out? (a) changes the text size (b) sets colours and fonts (c) adds space around boxes (d) counts down a timer
  12. 12.🌈 Which colour is rgb(0, 255, 0)? (a) blue (b) red (c) cyan (d) bright green
  13. 13.⚖️ Which selector is the strongest? (a) an element selector (b) an id selector (c) a class selector
  14. 14.🖌️ What colour are the letters?
    h1 {
      background-color: blue;
      font-size: 36px;
      color: purple;
      text-align: center;
    }
    (a) blue (b) purple (c) white
  15. 15.✍️ How many declarations (property: value pairs) are in this rule?
    #top {
      padding: 8px;
      font-weight: bold;
      width: 300px;
    }
  16. 16.🎯 Which element does the selector div style? (a) <h1 id="logo"> (b) <span> (c) <p class="big"> (d) <div class="big">
  17. 17.🌈 Which colour of light is strongest in rgb(123, 131, 217)? (a) blue (b) red (c) green
  18. 18.✍️ Which property is set to 20px in this rule?
    li {
      font-size: 20px;
      color: red;
      background-color: yellow;
    }
    (a) 20px (b) font-size (c) background-color (d) text-align
  19. 19.True or false: the border is a solid or dotted edge. (a) True (b) False
  20. 20.True or false: HTML checks a quiz answer. (a) False (b) True
  21. 21.⚖️ What colour is the text of this element?
    <p class="star" id="intro">Hi</p>
    CSS:
    p { color: black; }
    p { color: red; }
    (a) black (b) blue (c) white (d) red
  22. 22.🌈 Which colour is #ffffff? (a) bright green (b) red (c) magenta (d) white
  23. 23.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 260px;
      justify-content: flex-end;
    }
    Inside are 3 boxes, each 80px wide (no margins).
  24. 24.True or false: .card is an id selector. (a) True (b) False
  25. 25.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 120px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  26. 26.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 160px;
      padding: 5px;
      border: 3px solid black;
      margin: 0px;
    }
  27. 27.📱 Which tag helps phones show a page at the right size? (a) the hr tag (b) the viewport meta tag (c) the br tag (d) the title tag
  28. 28.✍️ What value is given to width in this rule?
    .box {
      background-color: yellow;
      width: 300px;
    }
    (a) 300px (b) italic (c) width (d) red
  29. 29.✍️ Which sign ends each CSS declaration? (a) ; (b) , (c) : (d) .
  30. 30.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 130px;
      padding: 10px;
      border: 2px solid black;
      margin: 5px;
    }
  31. 31.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 80px;
      padding: 20px;
      border: 4px solid black;
      margin: 15px;
    }
  32. 32.⚖️ What colour is the text of this element?
    <h2 class="big" id="logo">Hi</h2>
    CSS:
    h2 { color: orange; }
    #logo { color: red; }
    .big { color: purple; }
    (a) red (b) blue (c) orange (d) purple
  33. 33.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 190px;
      padding: 15px;
      border: 4px solid black;
      margin: 15px;
    }
  34. 34.🌈 Which colour of light is strongest in rgb(118, 33, 206)? (a) blue (b) green (c) red
  35. 35.True or false: #hero is an element selector. (a) True (b) False
  36. 36.🎯 Which CSS selector matches this element?
    <div class="box" id="top">Hello</div>
    (a) .box (b) #intro (c) span (d) .star
  37. 37.True or false: HTML makes a form box. (a) True (b) False
  38. 38.🖌️ What colour are the letters?
    h1 {
      color: purple;
      background-color: blue;
      text-align: right;
      font-size: 16px;
    }
    (a) blue (b) white (c) purple
  39. 39.🔍 Which is the odd one out? (a) reacts to a button click (b) checks a quiz answer (c) sets colours and fonts (d) changes the page live
  40. 40.True or false: #hero is a class selector. (a) True (b) False

Answer key

  1. packs boxes at the start
  2. white
  3. margin
  4. makes headings and lists
  5. 24
  6. 172
  7. 30
  8. blue
  9. the screen width
  10. True
  11. counts down a timer
  12. bright green
  13. an id selector
  14. purple
  15. 3
  16. <div class="big">
  17. blue
  18. font-size
  19. True
  20. False
  21. red
  22. white
  23. 20
  24. False
  25. 40
  26. 176
  27. the viewport meta tag
  28. 300px
  29. ;
  30. 164
  31. 158
  32. red
  33. 258
  34. blue
  35. False
  36. .box
  37. True
  38. purple
  39. sets colours and fonts
  40. False

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