← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 597 · 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.🌈 In #00e400 the green part is the hex number e4. What is it as a normal number?
  2. 2.⚖️ What colour is the text of this element?
    <h2 class="star" id="logo">Hi</h2>
    CSS:
    h2 { color: black; }
    h2 { color: white; }
    (a) orange (b) white (c) black (d) red
  3. 3.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 170px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 50px wide (no margins).
  4. 4.🎨 Which attribute adds CSS inside one tag? (a) style (b) href (c) alt (d) src
  5. 5.✍️ How many declarations (property: value pairs) are in this rule?
    body {
      font-size: 20px;
      border: 2px solid;
      font-weight: bold;
    }
  6. 6.🌈 Which colour is #0000ff? (a) bright green (b) black (c) red (d) blue
  7. 7.🎯 Which CSS selector matches this element?
    <div class="star" id="end">Hello</div>
    (a) .end (b) .star (c) span (d) #star
  8. 8.📱 Which tag helps phones show a page at the right size? (a) the title tag (b) the br tag (c) the hr tag (d) the viewport meta tag
  9. 9.🔍 Which is the odd one out? (a) puts a picture on a page (b) rounds box corners (c) adds space around boxes (d) lays out the page
  10. 10.🎯 Which element does the selector #intro style? (a) <li class="intro"> (b) <li id="intro"> (c) <div class="star"> (d) <li id="main">
  11. 11.💪 Which flexbox property spaces boxes along a row? (a) justify-content (b) display: flex (c) flex-direction (d) gap
  12. 12.🎯 Which CSS selector matches this element?
    <li class="star" id="logo">Hello</li>
    (a) #star (b) #end (c) .logo (d) .star
  13. 13.🌈 Hex digits go 0 to 9, then A to which letter? (a) Z (b) F (c) J (d) G
  14. 14.🌈 In #rrggbb, which colour do the first two digits give? (a) green (b) red (c) blue (d) black
  15. 15.✍️ Which property is set to red in this rule?
    .note {
      margin: 10px;
      color: red;
      padding: 8px;
    }
    (a) color (b) font-size (c) red (d) text-align
  16. 16.🎨 What does CSS stand for? (a) Creative Sheet System (b) Colourful Site Styles (c) Computer Style Sheets (d) Cascading Style Sheets
  17. 17.Which of these does JavaScript do? (a) puts a picture on a page (b) gives the page structure (c) changes the page live (d) rounds box corners
  18. 18.⚖️ What colour is the text of this element?
    <h1 class="star" id="main">Hi</h1>
    CSS:
    h1 { color: orange; }
    h1 { color: green; }
    (a) green (b) orange (c) red (d) black
  19. 19.🎯 Which CSS selector matches this element?
    <div class="big" id="main">Hello</div>
    (a) span (b) .big (c) .main (d) .red
  20. 20.True or false: .menu is a class selector. (a) False (b) True
  21. 21.🌈 Which colour is #00ffff? (a) magenta (b) blue (c) yellow (d) cyan
  22. 22.🎯 Which CSS selector matches this element?
    <p class="star" id="intro">Hello</p>
    (a) #star (b) .intro (c) .menu (d) p
  23. 23.✍️ Which sign ends each CSS declaration? (a) ; (b) . (c) , (d) :
  24. 24.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 220px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 80px wide (no margins).
  25. 25.📦 In the box model, which part is space inside the border? (a) border (b) content (c) margin (d) padding
  26. 26.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 18px;
      }
    }
    (a) Yes (b) No
  27. 27.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      color: red;
      font-size: 20px;
    }
  28. 28.🎯 What kind of selector is h1? (a) a class selector (b) an id selector (c) an element selector
  29. 29.🔍 Which is the odd one out? (a) changes the text size (b) makes a link (c) adds space around boxes (d) rounds box corners
  30. 30.🖌️ What colour is behind the letters?
    p {
      background-color: black;
      text-align: right;
      font-size: 24px;
      color: purple;
    }
    (a) black (b) purple (c) green
  31. 31.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 150px;
      padding: 10px;
      border: 1px solid black;
      margin: 20px;
    }
  32. 32.True or false: margin is the line round the box. (a) False (b) True
  33. 33.⚖️ Which selector is the weakest? (a) a class selector (b) an id selector (c) an element selector
  34. 34.⚖️ Which selector is the strongest? (a) a class selector (b) an id selector (c) an element selector
  35. 35.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      font-style: italic;
    }
  36. 36.🌈 Which colour is rgb(255, 255, 0)? (a) bright green (b) blue (c) cyan (d) yellow
  37. 37.💪 Which justify-content value packs boxes at the end? (a) center (b) flex-end (c) space-between (d) flex-start
  38. 38.🌈 In #003c00 the green part is the hex number 3c. What is it as a normal number?
  39. 39.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 130px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  40. 40.🌈 Which hex code is bright green? (a) #000000 (b) #0000ff (c) #00ff00 (d) #00ffff

Answer key

  1. 228
  2. white
  3. 20
  4. style
  5. 3
  6. blue
  7. .star
  8. the viewport meta tag
  9. puts a picture on a page
  10. <li id="intro">
  11. justify-content
  12. .star
  13. F
  14. red
  15. color
  16. Cascading Style Sheets
  17. changes the page live
  18. green
  19. .big
  20. True
  21. cyan
  22. p
  23. ;
  24. 60
  25. padding
  26. No
  27. 2
  28. an element selector
  29. makes a link
  30. black
  31. 172
  32. False
  33. an element selector
  34. an id selector
  35. 1
  36. yellow
  37. flex-end
  38. 60
  39. 50
  40. #00ff00

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