← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 239 · 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.📱 The screen is 1366px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 10px;
      }
    }
    (a) Yes (b) No
  2. 2.💪 Which justify-content value packs boxes at the start? (a) space-between (b) center (c) flex-start (d) flex-end
  3. 3.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 70px;
      padding: 20px;
      border: 1px solid black;
      margin: 10px;
    }
  4. 4.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 22px;
      }
    }
  5. 5.⚖️ What colour is the text of this element?
    <h2 class="menu" id="top">Hi</h2>
    CSS:
    h2 { color: black; }
    h2 { color: green; }
    (a) black (b) purple (c) orange (d) green
  6. 6.🎨 What does CSS stand for? (a) Creative Sheet System (b) Computer Style Sheets (c) Colourful Site Styles (d) Cascading Style Sheets
  7. 7.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 100px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  8. 8.What does justify-content: flex-start do? (a) equal gaps, none at ends (b) packs boxes at the start (c) packs boxes at the end (d) puts boxes in the middle
  9. 9.📦 In the box model, which part is the gap round content? (a) margin (b) content (c) border (d) padding
  10. 10.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) the later one (c) neither (d) the first one
  11. 11.🖌️ What colour are the letters?
    li {
      text-align: right;
      font-size: 32px;
      color: orange;
      background-color: purple;
    }
    (a) black (b) purple (c) orange
  12. 12.🖌️ What colour is behind the letters?
    p {
      font-size: 20px;
      background-color: green;
      text-align: left;
      color: black;
    }
    (a) green (b) yellow (c) black
  13. 13.✍️ What value is given to font-style in this rule?
    #top {
      color: red;
      background-color: yellow;
      text-align: center;
      font-style: italic;
    }
    (a) font-style (b) red (c) 20px (d) italic
  14. 14.🔍 Which is the odd one out? (a) sets colours and fonts (b) makes a form box (c) puts a picture on a page (d) makes a link
  15. 15.⚖️ What colour is the text of this element?
    <p class="menu" id="main">Hi</p>
    CSS:
    .menu { color: green; }
    #main { color: yellow; }
    p { color: white; }
    (a) white (b) green (c) purple (d) yellow
  16. 16.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 22px;
      }
    }
  17. 17.✍️ In color: blue; which part is the value? (a) color (b) : (c) blue (d) ;
  18. 18.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 170px;
      padding: 15px;
      border: 5px solid black;
      margin: 20px;
    }
  19. 19.True or false: CSS sets colours and fonts. (a) True (b) False
  20. 20.🖌️ Which CSS property makes the text bold? (a) font-family (b) text-align (c) font-weight (d) color
  21. 21.True or false: the border is a solid or dotted edge. (a) False (b) True
  22. 22.⚖️ What colour is the text of this element?
    <p class="big" id="main">Hi</p>
    CSS:
    .big { color: orange; }
    p { color: black; }
    #main { color: green; }
    (a) blue (b) green (c) black (d) orange
  23. 23.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 380px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 80px wide (no margins).
  24. 24.🧩 Which language checks a quiz answer? (a) CSS (b) JavaScript (c) HTML
  25. 25.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      text-align: center;
      margin: 10px;
      color: red;
      border: 2px solid;
    }
  26. 26.🎯 Which sign starts a class selector? (a) & (b) @ (c) . (d) #
  27. 27.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 12px;
      }
    }
    (a) Yes (b) No
  28. 28.🎯 Which element does the selector .box style? (a) <div id="box"> (b) <div class="star"> (c) <span class="menu"> (d) <div class="box">
  29. 29.🎯 How many elements on a page should have the same id? (a) 5 (b) 2 (c) 1 (d) any number
  30. 30.🎯 What kind of selector is #end? (a) a class selector (b) an id selector (c) an element selector
  31. 31.✍️ Which property is set to 20px in this rule?
    body {
      font-size: 20px;
      font-weight: bold;
      border: 2px solid;
    }
    (a) background-color (b) 20px (c) font-size (d) text-align
  32. 32.🎯 Which CSS selector matches this element?
    <h2 class="star" id="hero">Hello</h2>
    (a) h2 (b) .hero (c) li (d) #star
  33. 33.🎯 Which sign starts an id selector? (a) # (b) & (c) . (d) @
  34. 34.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 16px;
      }
    }
    (a) Yes (b) No
  35. 35.✍️ Which property is set to 300px in this rule?
    .box {
      color: red;
      width: 300px;
    }
    (a) width (b) 300px (c) font-style (d) color
  36. 36.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 120px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  37. 37.⚖️ What colour is the text of this element?
    <h1 class="red" id="top">Hi</h1>
    CSS:
    .red { color: black; }
    .red { color: red; }
    (a) blue (b) red (c) black (d) purple
  38. 38.🧩 Which language shows a pop-up message? (a) JavaScript (b) CSS (c) HTML
  39. 39.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 240px;
      padding: 5px;
      border: 2px solid black;
      margin: 15px;
    }
  40. 40.🖌️ Which CSS property picks the font style? (a) text-align (b) font-size (c) font-family (d) background-color

Answer key

  1. No
  2. flex-start
  3. 132
  4. 24
  5. green
  6. Cascading Style Sheets
  7. 20
  8. packs boxes at the start
  9. padding
  10. the later one
  11. orange
  12. green
  13. italic
  14. sets colours and fonts
  15. yellow
  16. 22
  17. blue
  18. 250
  19. True
  20. font-weight
  21. True
  22. green
  23. 20
  24. JavaScript
  25. 4
  26. .
  27. No
  28. <div class="box">
  29. 1
  30. an id selector
  31. font-size
  32. h2
  33. #
  34. No
  35. width
  36. 20
  37. red
  38. JavaScript
  39. 254
  40. font-family

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