← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 743 · 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 top to bottom (px) does this box take in all, margin included?
    .box {
      height: 130px;
      padding: 15px;
      border: 5px solid black;
      margin: 5px;
    }
  2. 2.Which of these is padding? (a) space outside the border (b) space inside the border (c) the text or picture (d) the line round the box
  3. 3.🎯 Which CSS selector matches this element?
    <li class="note" id="hero">Hello</li>
    (a) .big (b) div (c) #top (d) li
  4. 4.True or false: CSS sets colours and fonts. (a) False (b) True
  5. 5.📦 In the box model, which part is the gap to other boxes? (a) padding (b) content (c) border (d) margin
  6. 6.📦 In the box model, which part is a solid or dotted edge? (a) border (b) margin (c) content (d) padding
  7. 7.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 20px;
      }
    }
  8. 8.🧩 Which language lays out the page? (a) HTML (b) JavaScript (c) CSS
  9. 9.🎯 Can many elements share the same class? (a) Yes (b) No
  10. 10.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 10px;
      }
    }
  11. 11.⚖️ What colour is the text of this element?
    <p class="big" id="intro">Hi</p>
    CSS:
    p { color: white; }
    .big { color: purple; }
    #intro { color: red; }
    (a) black (b) purple (c) red (d) white
  12. 12.⚖️ Which selector is the weakest? (a) a class selector (b) an id selector (c) an element selector
  13. 13.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 120px;
      padding: 20px;
      border: 1px solid black;
      margin: 10px;
    }
  14. 14.⚖️ What colour is the text of this element?
    <p class="big" id="main">Hi</p>
    CSS:
    .big { color: red; }
    #main { color: white; }
    (a) red (b) white (c) blue (d) green
  15. 15.💪 Which flexbox property spaces boxes along a row? (a) display: flex (b) flex-direction (c) gap (d) justify-content
  16. 16.✍️ What is the selector in this CSS rule?
    #top {
      background-color: yellow;
      border: 2px solid;
      padding: 8px;
    }
    (a) background-color (b) #top (c) 2px solid (d) li
  17. 17.💪 Which justify-content value packs boxes at the end? (a) flex-end (b) flex-start (c) center (d) space-between
  18. 18.✍️ Which property is set to yellow in this rule?
    li {
      padding: 8px;
      background-color: yellow;
      font-style: italic;
      width: 300px;
    }
    (a) margin (b) background-color (c) yellow (d) padding
  19. 19.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 8px;
      }
    }
    (a) No (b) Yes
  20. 20.True or false: the border is the gap round content. (a) False (b) True
  21. 21.True or false: .menu is an id selector. (a) True (b) False
  22. 22.🌈 Which hex code is yellow? (a) #000000 (b) #ffff00 (c) #0000ff (d) #ffffff
  23. 23.✍️ How does a CSS comment start? (a) # (b) <!-- (c) // (d) /*
  24. 24.🎯 Which CSS selector matches this element?
    <span class="star" id="top">Hello</span>
    (a) p (b) .menu (c) .top (d) #top
  25. 25.⚖️ What colour is the text of this element?
    <p class="note" id="intro">Hi</p>
    CSS:
    #intro { color: purple; }
    #intro { color: yellow; }
    (a) white (b) yellow (c) purple (d) blue
  26. 26.⚖️ What colour is the text of this element?
    <h1 class="note" id="top">Hi</h1>
    CSS:
    #top { color: red; }
    h1 { color: yellow; }
    .note { color: green; }
    (a) yellow (b) white (c) green (d) red
  27. 27.True or false: HTML makes a form box. (a) False (b) True
  28. 28.🌈 Which colour is #ff0000? (a) yellow (b) blue (c) red (d) bright green
  29. 29.💪 Which flexbox property lines boxes up across? (a) align-items (b) gap (c) display: flex (d) flex-direction
  30. 30.🔍 Which is the odd one out? (a) gives the page structure (b) makes a link (c) reacts to a button click (d) puts a picture on a page
  31. 31.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 280px;
      padding: 5px;
      border: 1px solid black;
      margin: 15px;
    }
  32. 32.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 16px;
      }
    }
    (a) No (b) Yes
  33. 33.🌈 Which hex code is bright green? (a) #ff0000 (b) #0000ff (c) #00ff00 (d) #ffff00
  34. 34.📱 Which tag helps phones show a page at the right size? (a) the hr tag (b) the title tag (c) the br tag (d) the viewport meta tag
  35. 35.✍️ Which sign goes between a property and its value? (a) - (b) = (c) : (d) ;
  36. 36.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      font-weight: bold;
    }
  37. 37.🎨 A CSS file usually ends with which extension? (a) .js (b) .html (c) .css (d) .png
  38. 38.True or false: body is a class selector. (a) True (b) False
  39. 39.🖌️ What colour are the letters?
    h1 {
      font-size: 28px;
      background-color: green;
      text-align: right;
      color: blue;
    }
    (a) red (b) green (c) blue
  40. 40.True or false: CSS makes a form box. (a) True (b) False

Answer key

  1. 180
  2. space inside the border
  3. li
  4. True
  5. margin
  6. border
  7. 20
  8. CSS
  9. Yes
  10. 10
  11. red
  12. an element selector
  13. 182
  14. white
  15. justify-content
  16. #top
  17. flex-end
  18. background-color
  19. Yes
  20. False
  21. False
  22. #ffff00
  23. /*
  24. #top
  25. yellow
  26. red
  27. True
  28. red
  29. align-items
  30. reacts to a button click
  31. 292
  32. No
  33. #00ff00
  34. the viewport meta tag
  35. :
  36. 1
  37. .css
  38. False
  39. blue
  40. False

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