← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 998 · 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 many declarations (property: value pairs) are in this rule?
    .note {
      text-align: center;
      margin: 10px;
      font-style: italic;
    }
  2. 2.🖌️ Where does the text sit on its line?
    li {
      text-align: left;
      font-size: 20px;
      color: purple;
      background-color: red;
    }
    (a) on the right (b) in the middle (c) on the left
  3. 3.🌈 Which hex code is blue? (a) #ff0000 (b) #ffff00 (c) #ff00ff (d) #0000ff
  4. 4.True or false: padding is the line round the box. (a) True (b) False
  5. 5.⚖️ What colour is the text of this element?
    <p class="menu" id="end">Hi</p>
    CSS:
    .menu { color: green; }
    .menu { color: red; }
    (a) green (b) purple (c) red (d) yellow
  6. 6.True or false: the content is the gap round content. (a) False (b) True
  7. 7.What does font-family do? (a) picks the font style (b) centres a heading (c) sets the letter colour (d) colours behind the text
  8. 8.🎯 Which sign starts an id selector? (a) . (b) # (c) @ (d) &
  9. 9.🌈 Which colour of light is strongest in rgb(72, 161, 3)? (a) blue (b) green (c) red
  10. 10.🎨 Which attribute adds CSS inside one tag? (a) src (b) style (c) href (d) alt
  11. 11.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 190px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  12. 12.🎯 Which element does the selector p style? (a) <h2 class="menu"> (b) <p class="menu"> (c) <li id="logo"> (d) <h1>
  13. 13.⚖️ What colour is the text of this element?
    <h2 class="note" id="logo">Hi</h2>
    CSS:
    h2 { color: purple; }
    #logo { color: green; }
    (a) green (b) white (c) purple (d) orange
  14. 14.⚖️ Which selector is the strongest? (a) an element selector (b) an id selector (c) a class selector
  15. 15.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 30px;
      }
    }
  16. 16.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 70px;
      padding: 30px;
      border: 1px solid black;
      margin: 10px;
    }
  17. 17.🎯 What kind of selector is .menu? (a) a class selector (b) an element selector (c) an id selector
  18. 18.⚖️ What colour is the text of this element?
    <h1 class="big" id="end">Hi</h1>
    CSS:
    .big { color: red; }
    #end { color: purple; }
    (a) purple (b) green (c) red (d) yellow
  19. 19.💪 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 40px wide (no margins).
  20. 20.🎨 What does CSS stand for? (a) Computer Style Sheets (b) Creative Sheet System (c) Cascading Style Sheets (d) Colourful Site Styles
  21. 21.✍️ Which property is set to 10px in this rule?
    body {
      margin: 10px;
      border: 2px solid;
      font-weight: bold;
      text-align: center;
    }
    (a) 10px (b) font-weight (c) padding (d) margin
  22. 22.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 18px;
      }
    }
  23. 23.🎯 What kind of selector is #top? (a) an id selector (b) an element selector (c) a class selector
  24. 24.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 210px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  25. 25.🌈 Hex digits go 0 to 9, then A to which letter? (a) Z (b) F (c) G (d) J
  26. 26.✍️ Which property is set to 20px in this rule?
    li {
      margin: 10px;
      font-size: 20px;
      background-color: yellow;
    }
    (a) background-color (b) 20px (c) text-align (d) font-size
  27. 27.📦 In the box model, which part is space inside the border? (a) border (b) padding (c) margin (d) content
  28. 28.📦 In the box model, which part is a solid or dotted edge? (a) content (b) padding (c) border (d) margin
  29. 29.⚖️ Which selector is the weakest? (a) an id selector (b) a class selector (c) an element selector
  30. 30.✍️ What value is given to padding in this rule?
    p {
      font-style: italic;
      background-color: yellow;
      color: red;
      padding: 8px;
    }
    (a) bold (b) 2px solid (c) padding (d) 8px
  31. 31.🎯 Which element does the selector .big style? (a) <span class="box"> (b) <div class="big"> (c) <div id="big"> (d) <div class="red">
  32. 32.✍️ Which sign ends each CSS declaration? (a) . (b) : (c) , (d) ;
  33. 33.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 8px;
      }
    }
  34. 34.True or false: JavaScript reacts to a button click. (a) False (b) True
  35. 35.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 12px;
      }
    }
  36. 36.✍️ How many declarations (property: value pairs) are in this rule?
    body {
      margin: 10px;
    }
  37. 37.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 4 (b) 6 (c) 3 (d) 2
  38. 38.🖌️ Which CSS property picks the font style? (a) font-weight (b) text-align (c) font-family (d) color
  39. 39.⚖️ What colour is the text of this element?
    <h1 class="red" id="main">Hi</h1>
    CSS:
    .red { color: yellow; }
    .red { color: purple; }
    (a) yellow (b) black (c) orange (d) purple
  40. 40.⚖️ What colour is the text of this element?
    <h1 class="menu" id="hero">Hi</h1>
    CSS:
    h1 { color: yellow; }
    h1 { color: white; }
    (a) white (b) purple (c) orange (d) yellow

Answer key

  1. 3
  2. on the left
  3. #0000ff
  4. False
  5. red
  6. False
  7. picks the font style
  8. #
  9. green
  10. style
  11. 10
  12. <p class="menu">
  13. green
  14. an id selector
  15. 24
  16. 152
  17. a class selector
  18. purple
  19. 40
  20. Cascading Style Sheets
  21. margin
  22. 18
  23. an id selector
  24. 10
  25. F
  26. font-size
  27. padding
  28. border
  29. an element selector
  30. 8px
  31. <div class="big">
  32. ;
  33. 8
  34. True
  35. 16
  36. 1
  37. 3
  38. font-family
  39. purple
  40. white

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