← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 736 · 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 flexbox property turns on flexbox? (a) display: flex (b) gap (c) flex-direction (d) justify-content
  2. 2.📦 In the box model, which part is space inside the border? (a) margin (b) border (c) padding (d) content
  3. 3.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 560px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 80px wide (no margins).
  4. 4.🎯 Which sign starts an id selector? (a) & (b) # (c) . (d) @
  5. 5.🎯 What kind of selector is #hero? (a) an element selector (b) a class selector (c) an id selector
  6. 6.🎨 What does CSS stand for? (a) Computer Style Sheets (b) Creative Sheet System (c) Cascading Style Sheets (d) Colourful Site Styles
  7. 7.True or false: JavaScript makes a link. (a) False (b) True
  8. 8.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 260px;
      justify-content: center;
    }
    Inside are 3 boxes, each 40px wide (no margins).
  9. 9.💪 Which flexbox property spaces boxes along a row? (a) gap (b) justify-content (c) flex-direction (d) align-items
  10. 10.What does color do? (a) sets the letter colour (b) makes the text bold (c) colours behind the text (d) picks the font style
  11. 11.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 240px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 60px wide (no margins).
  12. 12.🌈 In #007d00 the green part is the hex number 7d. What is it as a normal number?
  13. 13.🖌️ Which CSS property picks the font style? (a) font-family (b) text-align (c) font-size (d) background-color
  14. 14.🎯 Can many elements share the same class? (a) No (b) Yes
  15. 15.🌈 Which colour is rgb(0, 0, 0)? (a) red (b) cyan (c) magenta (d) black
  16. 16.⚖️ What colour is the text of this element?
    <h1 class="box" id="end">Hi</h1>
    CSS:
    .box { color: yellow; }
    .box { color: blue; }
    (a) yellow (b) red (c) purple (d) blue
  17. 17.🌈 Which colour is rgb(0, 0, 255)? (a) black (b) blue (c) red (d) cyan
  18. 18.🌈 Which colour is rgb(0, 255, 0)? (a) magenta (b) blue (c) bright green (d) red
  19. 19.💪 Which justify-content value packs boxes at the end? (a) flex-end (b) space-between (c) flex-start (d) center
  20. 20.🌈 Which colour of light is strongest in rgb(200, 82, 122)? (a) blue (b) green (c) red
  21. 21.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 14px;
      }
    }
  22. 22.True or false: #main is an element selector. (a) False (b) True
  23. 23.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 90px;
      padding: 25px;
      border: 2px solid black;
      margin: 10px;
    }
  24. 24.🎯 Which element does the selector h2 style? (a) <div class="menu"> (b) <h2 class="menu"> (c) <li> (d) <span id="end">
  25. 25.✍️ How does a CSS comment start? (a) /* (b) # (c) // (d) <!--
  26. 26.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 10px;
      }
    }
  27. 27.🖌️ What colour are the letters?
    p {
      color: red;
      font-size: 36px;
      text-align: right;
      background-color: yellow;
    }
    (a) purple (b) yellow (c) red
  28. 28.True or false: JavaScript reacts to a button click. (a) False (b) True
  29. 29.True or false: margin is the gap to other boxes. (a) False (b) True
  30. 30.🌈 Which hex code is white? (a) #ffff00 (b) #00ffff (c) #00ff00 (d) #ffffff
  31. 31.🖌️ What colour are the letters?
    p {
      text-align: left;
      color: black;
      font-size: 20px;
      background-color: purple;
    }
    (a) red (b) black (c) purple
  32. 32.🌈 In #0000b4 the blue part is the hex number b4. What is it as a normal number?
  33. 33.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 30px;
      }
    }
    (a) Yes (b) No
  34. 34.⚖️ What colour is the text of this element?
    <h1 class="box" id="top">Hi</h1>
    CSS:
    #top { color: white; }
    .box { color: blue; }
    (a) purple (b) white (c) blue (d) red
  35. 35.True or false: padding is space inside the border. (a) False (b) True
  36. 36.True or false: h1 is a class selector. (a) True (b) False
  37. 37.What does background-color do? (a) centres a heading (b) sets the letter colour (c) colours behind the text (d) picks the font style
  38. 38.🧩 Which language lays out the page? (a) JavaScript (b) CSS (c) HTML
  39. 39.Which of these does CSS do? (a) makes a link (b) makes a form box (c) changes the text size (d) counts down a timer
  40. 40.🖌️ Which CSS property centres a heading? (a) font-weight (b) color (c) text-align (d) font-family

Answer key

  1. display: flex
  2. padding
  3. 80
  4. #
  5. an id selector
  6. Cascading Style Sheets
  7. False
  8. 70
  9. justify-content
  10. sets the letter colour
  11. 60
  12. 125
  13. font-family
  14. Yes
  15. black
  16. blue
  17. blue
  18. bright green
  19. flex-end
  20. red
  21. 12
  22. False
  23. 164
  24. <h2 class="menu">
  25. /*
  26. 10
  27. red
  28. True
  29. True
  30. #ffffff
  31. black
  32. 180
  33. No
  34. white
  35. True
  36. False
  37. colours behind the text
  38. CSS
  39. changes the text size
  40. text-align

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