← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 964 · 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 colour is the text of this element?
    <h2 class="red" id="top">Hi</h2>
    CSS:
    h2 { color: white; }
    .red { color: green; }
    #top { color: black; }
    (a) red (b) green (c) black (d) white
  2. 2.🎨 What does CSS stand for? (a) Cascading Style Sheets (b) Colourful Site Styles (c) Creative Sheet System (d) Computer Style Sheets
  3. 3.✍️ What is the selector in this CSS rule?
    h2 {
      text-align: center;
      background-color: yellow;
    }
    (a) text-align (b) h1 (c) h2 (d) yellow
  4. 4.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      padding: 8px;
      margin: 10px;
    }
  5. 5.Which of these is the content? (a) the line round the box (b) space inside the border (c) the gap to other boxes (d) the text or picture
  6. 6.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 28px;
      }
    }
  7. 7.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 22px;
      }
    }
  8. 8.⚖️ What colour is the text of this element?
    <p class="box" id="intro">Hi</p>
    CSS:
    .box { color: black; }
    p { color: green; }
    #intro { color: orange; }
    (a) black (b) green (c) orange (d) red
  9. 9.✍️ Which sign goes between a property and its value? (a) - (b) : (c) ; (d) =
  10. 10.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 140px;
      justify-content: center;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  11. 11.What does justify-content: flex-end do? (a) packs boxes at the start (b) packs boxes at the end (c) equal gaps, none at ends (d) puts boxes in the middle
  12. 12.🌈 Which hex code is black? (a) #0000ff (b) #00ff00 (c) #000000 (d) #ffffff
  13. 13.✍️ What value is given to border in this rule?
    body {
      border: 2px solid;
      font-style: italic;
    }
    (a) italic (b) 2px solid (c) 300px (d) border
  14. 14.💪 Which flexbox property sets space between boxes? (a) flex-direction (b) justify-content (c) gap (d) display: flex
  15. 15.🌈 Which colour is #0000ff? (a) bright green (b) blue (c) white (d) red
  16. 16.What does background-color do? (a) makes letters bigger (b) centres a heading (c) sets the letter colour (d) colours behind the text
  17. 17.🌈 Which colour is #000000? (a) red (b) bright green (c) blue (d) black
  18. 18.🖌️ What colour is behind the letters?
    h1 {
      color: blue;
      text-align: left;
      font-size: 12px;
      background-color: purple;
    }
    (a) blue (b) purple (c) black
  19. 19.🎯 What kind of selector is body? (a) an element selector (b) a class selector (c) an id selector
  20. 20.⚖️ What colour is the text of this element?
    <h1 class="red" id="logo">Hi</h1>
    CSS:
    #logo { color: black; }
    .red { color: yellow; }
    (a) yellow (b) blue (c) black (d) orange
  21. 21.🖌️ Which CSS property makes letters bigger? (a) color (b) text-align (c) font-size (d) font-family
  22. 22.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 22px;
      }
    }
  23. 23.🔍 Which is the odd one out? (a) makes a link (b) rounds box corners (c) puts a picture on a page (d) gives the page structure
  24. 24.🖌️ Which CSS property colours behind the text? (a) background-color (b) color (c) font-weight (d) font-family
  25. 25.🎯 What kind of selector is p? (a) a class selector (b) an id selector (c) an element selector
  26. 26.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) the first one (c) neither (d) the later one
  27. 27.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 130px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  28. 28.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 18px;
      }
    }
    (a) No (b) Yes
  29. 29.🖌️ Where does the text sit on its line?
    h2 {
      text-align: right;
      font-size: 36px;
      background-color: purple;
      color: black;
    }
    (a) on the right (b) on the left (c) in the middle
  30. 30.⚖️ What colour is the text of this element?
    <p class="red" id="logo">Hi</p>
    CSS:
    .red { color: green; }
    p { color: black; }
    (a) black (b) blue (c) white (d) green
  31. 31.🌈 Which colour is rgb(0, 0, 255)? (a) red (b) blue (c) black (d) bright green
  32. 32.What does justify-content: flex-start do? (a) packs boxes at the start (b) puts boxes in the middle (c) equal gaps, none at ends (d) packs boxes at the end
  33. 33.✍️ What value is given to font-style in this rule?
    h1 {
      font-style: italic;
      text-align: center;
      font-size: 20px;
    }
    (a) font-style (b) italic (c) red (d) 20px
  34. 34.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      font-size: 20px;
      border: 2px solid;
      font-style: italic;
    }
  35. 35.⚖️ Which selector is the strongest? (a) an element selector (b) a class selector (c) an id selector
  36. 36.True or false: img is an id selector. (a) False (b) True
  37. 37.✍️ How many declarations (property: value pairs) are in this rule?
    #top {
      border: 2px solid;
    }
  38. 38.🎯 Can many elements share the same class? (a) No (b) Yes
  39. 39.True or false: the content is a solid or dotted edge. (a) True (b) False
  40. 40.✍️ What is the selector in this CSS rule?
    p {
      font-size: 20px;
      color: red;
      padding: 8px;
    }
    (a) font-size (b) .note (c) red (d) p

Answer key

  1. black
  2. Cascading Style Sheets
  3. h2
  4. 2
  5. the text or picture
  6. 28
  7. 20
  8. orange
  9. :
  10. 30
  11. packs boxes at the end
  12. #000000
  13. 2px solid
  14. gap
  15. blue
  16. colours behind the text
  17. black
  18. purple
  19. an element selector
  20. black
  21. font-size
  22. 22
  23. rounds box corners
  24. background-color
  25. an element selector
  26. the later one
  27. 10
  28. No
  29. on the right
  30. green
  31. blue
  32. packs boxes at the start
  33. italic
  34. 3
  35. an id selector
  36. False
  37. 1
  38. Yes
  39. False
  40. p

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