← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 920 · 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.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 260px;
      padding: 20px;
      border: 2px solid black;
      margin: 10px;
    }
  2. 2.⚖️ What colour is the text of this element?
    <p class="big" id="end">Hi</p>
    CSS:
    #end { color: green; }
    #end { color: black; }
    (a) green (b) red (c) black (d) orange
  3. 3.✍️ In color: blue; which part is the value? (a) ; (b) blue (c) color (d) :
  4. 4.💪 Which flexbox property turns on flexbox? (a) justify-content (b) gap (c) flex-direction (d) display: flex
  5. 5.🖌️ What colour is behind the letters?
    p {
      background-color: black;
      text-align: center;
      font-size: 28px;
      color: yellow;
    }
    (a) yellow (b) red (c) black
  6. 6.What does color do? (a) colours behind the text (b) sets the letter colour (c) makes the text bold (d) centres a heading
  7. 7.🌈 In #rrggbb, which colour do the first two digits give? (a) blue (b) red (c) green (d) black
  8. 8.💪 Which flexbox property lines boxes up across? (a) flex-direction (b) align-items (c) justify-content (d) display: flex
  9. 9.✍️ Which sign ends each CSS declaration? (a) . (b) ; (c) , (d) :
  10. 10.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 28px;
      }
    }
    (a) Yes (b) No
  11. 11.🎯 Which element does the selector p style? (a) <h1> (b) <li id="hero"> (c) <p class="star"> (d) <h2 class="star">
  12. 12.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 290px;
      padding: 5px;
      border: 4px solid black;
      margin: 0px;
    }
  13. 13.🎯 Can many elements share the same class? (a) No (b) Yes
  14. 14.🌈 Which hex code is cyan? (a) #00ff00 (b) #000000 (c) #ffff00 (d) #00ffff
  15. 15.🌈 In #008c00 the green part is the hex number 8c. What is it as a normal number?
  16. 16.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the first one (b) the shorter one (c) neither (d) the later one
  17. 17.🎯 What kind of selector is li? (a) an id selector (b) an element selector (c) a class selector
  18. 18.Which of these does CSS do? (a) shows a pop-up message (b) changes the page live (c) gives the page structure (d) lays out the page
  19. 19.📱 Responsive design means a page ___. (a) has no pictures (b) fits every screen (c) is only for laptops (d) never changes
  20. 20.🎯 What kind of selector is .menu? (a) an element selector (b) a class selector (c) an id selector
  21. 21.🎯 Which sign starts an id selector? (a) . (b) @ (c) & (d) #
  22. 22.⚖️ Which selector is the weakest? (a) an id selector (b) a class selector (c) an element selector
  23. 23.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 130px;
      padding: 10px;
      border: 3px solid black;
      margin: 0px;
    }
  24. 24.Which of these is margin? (a) the line round the box (b) space inside the border (c) the gap to other boxes (d) the gap round content
  25. 25.⚖️ What colour is the text of this element?
    <h2 class="red" id="logo">Hi</h2>
    CSS:
    .red { color: white; }
    .red { color: red; }
    (a) white (b) blue (c) red (d) black
  26. 26.🌈 Hex digits go 0 to 9, then A to which letter? (a) G (b) F (c) J (d) Z
  27. 27.🔍 Which is the odd one out? (a) checks a quiz answer (b) shows a pop-up message (c) changes the text size (d) changes the page live
  28. 28.🌈 Which hex code is blue? (a) #00ffff (b) #00ff00 (c) #0000ff (d) #000000
  29. 29.True or false: the border is the line round the box. (a) False (b) True
  30. 30.⚖️ What colour is the text of this element?
    <p class="menu" id="top">Hi</p>
    CSS:
    #top { color: blue; }
    p { color: yellow; }
    (a) orange (b) blue (c) red (d) yellow
  31. 31.📱 What does a media query check? (a) the page title (b) the time of day (c) the screen width (d) the battery level
  32. 32.📦 In the box model, which part is the gap to other boxes? (a) content (b) margin (c) padding (d) border
  33. 33.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 210px;
      padding: 25px;
      border: 4px solid black;
      margin: 0px;
    }
  34. 34.True or false: JavaScript reacts to a button click. (a) True (b) False
  35. 35.🌈 Which colour is rgb(0, 255, 255)? (a) magenta (b) cyan (c) white (d) yellow
  36. 36.📦 In the box model, which part is space outside the border? (a) border (b) margin (c) content (d) padding
  37. 37.🖌️ Which CSS property colours behind the text? (a) text-align (b) color (c) background-color (d) font-size
  38. 38.True or false: #top is an id selector. (a) True (b) False
  39. 39.⚖️ What colour is the text of this element?
    <p class="big" id="logo">Hi</p>
    CSS:
    p { color: green; }
    p { color: purple; }
    (a) blue (b) green (c) purple (d) white
  40. 40.🖌️ What colour are the letters?
    li {
      color: yellow;
      font-size: 24px;
      background-color: red;
      text-align: left;
    }
    (a) black (b) yellow (c) red

Answer key

  1. 324
  2. black
  3. blue
  4. display: flex
  5. black
  6. sets the letter colour
  7. red
  8. align-items
  9. ;
  10. No
  11. <p class="star">
  12. 308
  13. Yes
  14. #00ffff
  15. 140
  16. the later one
  17. an element selector
  18. lays out the page
  19. fits every screen
  20. a class selector
  21. #
  22. an element selector
  23. 156
  24. the gap to other boxes
  25. red
  26. F
  27. changes the text size
  28. #0000ff
  29. True
  30. blue
  31. the screen width
  32. margin
  33. 268
  34. True
  35. cyan
  36. margin
  37. background-color
  38. True
  39. purple
  40. yellow

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