← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 344 · 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 does justify-content: flex-start do? (a) packs boxes at the end (b) equal gaps, none at ends (c) packs boxes at the start (d) puts boxes in the middle
  2. 2.Which of these does JavaScript do? (a) makes a link (b) sets colours and fonts (c) adds space around boxes (d) changes the page live
  3. 3.⚖️ What colour is the text of this element?
    <p class="note" id="logo">Hi</p>
    CSS:
    .note { color: green; }
    #logo { color: yellow; }
    p { color: red; }
    (a) red (b) blue (c) green (d) yellow
  4. 4.🌈 Which hex code is white? (a) #00ffff (b) #ffffff (c) #00ff00 (d) #000000
  5. 5.Which of these is the border? (a) the gap round content (b) the text or picture (c) space outside the border (d) the line round the box
  6. 6.True or false: JavaScript checks a quiz answer. (a) True (b) False
  7. 7.✍️ What value is given to font-size in this rule?
    h2 {
      font-size: 20px;
      padding: 8px;
      text-align: center;
      font-style: italic;
    }
    (a) 20px (b) center (c) yellow (d) font-size
  8. 8.✍️ What is the selector in this CSS rule?
    .note {
      width: 300px;
      font-style: italic;
      font-weight: bold;
    }
    (a) width (b) #top (c) .note (d) italic
  9. 9.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 18px;
      }
    }
  10. 10.✍️ What is the selector in this CSS rule?
    p {
      font-style: italic;
      padding: 8px;
      color: red;
    }
    (a) .note (b) font-style (c) p (d) 8px
  11. 11.✍️ Which property is set to 10px in this rule?
    h1 {
      margin: 10px;
      font-size: 20px;
    }
    (a) font-weight (b) margin (c) 10px (d) padding
  12. 12.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 14px;
      }
    }
    (a) No (b) Yes
  13. 13.🎯 Which element does the selector .menu style? (a) <h1 class="note"> (b) <h1 class="menu"> (c) <h1 id="menu"> (d) <h2 class="big">
  14. 14.🌈 Which colour is #ff0000? (a) red (b) blue (c) bright green (d) black
  15. 15.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 140px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  16. 16.📦 In the box model, which part is a solid or dotted edge? (a) content (b) padding (c) margin (d) border
  17. 17.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 340px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 80px wide (no margins).
  18. 18.⚖️ What colour is the text of this element?
    <h1 class="menu" id="intro">Hi</h1>
    CSS:
    #intro { color: red; }
    #intro { color: white; }
    (a) blue (b) orange (c) white (d) red
  19. 19.🌈 In #000b00 the green part is the hex number 0b. What is it as a normal number?
  20. 20.🎯 Which CSS selector matches this element?
    <p class="box" id="top">Hello</p>
    (a) #intro (b) p (c) .top (d) h1
  21. 21.🎯 Which element does the selector p style? (a) <h2 class="star"> (b) <p class="star"> (c) <li id="hero"> (d) <h1>
  22. 22.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 26px;
      }
    }
    (a) Yes (b) No
  23. 23.✍️ How does a CSS comment start? (a) # (b) /* (c) <!-- (d) //
  24. 24.What does justify-content: center do? (a) packs boxes at the start (b) equal gaps, none at ends (c) packs boxes at the end (d) puts boxes in the middle
  25. 25.🌈 Which colour is rgb(255, 255, 255)? (a) bright green (b) cyan (c) white (d) yellow
  26. 26.🎯 What kind of selector is .card? (a) an element selector (b) a class selector (c) an id selector
  27. 27.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the later one (b) neither (c) the first one (d) the shorter one
  28. 28.📦 In the box model, which part is the line round the box? (a) margin (b) content (c) border (d) padding
  29. 29.✍️ What is the selector in this CSS rule?
    .note {
      font-weight: bold;
      padding: 8px;
      background-color: yellow;
    }
    (a) 8px (b) font-weight (c) #top (d) .note
  30. 30.True or false: JavaScript makes a link. (a) False (b) True
  31. 31.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 340px;
      justify-content: center;
    }
    Inside are 4 boxes, each 80px wide (no margins).
  32. 32.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 20px;
      }
    }
  33. 33.Which of these does HTML do? (a) rounds box corners (b) lays out the page (c) makes headings and lists (d) changes the page live
  34. 34.🎨 A CSS file usually ends with which extension? (a) .css (b) .js (c) .png (d) .html
  35. 35.⚖️ What colour is the text of this element?
    <h1 class="red" id="top">Hi</h1>
    CSS:
    h1 { color: blue; }
    .red { color: yellow; }
    #top { color: red; }
    (a) blue (b) yellow (c) red (d) white
  36. 36.🎯 What kind of selector is .big? (a) a class selector (b) an id selector (c) an element selector
  37. 37.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 14px;
      }
    }
    (a) Yes (b) No
  38. 38.🖌️ What colour is behind the letters?
    p {
      background-color: red;
      text-align: center;
      color: white;
      font-size: 12px;
    }
    (a) white (b) red (c) blue
  39. 39.🧩 Which language checks a quiz answer? (a) HTML (b) CSS (c) JavaScript
  40. 40.⚖️ What colour is the text of this element?
    <h1 class="box" id="top">Hi</h1>
    CSS:
    #top { color: black; }
    .box { color: purple; }
    (a) white (b) purple (c) blue (d) black

Answer key

  1. packs boxes at the start
  2. changes the page live
  3. yellow
  4. #ffffff
  5. the line round the box
  6. True
  7. 20px
  8. .note
  9. 18
  10. p
  11. margin
  12. Yes
  13. <h1 class="menu">
  14. red
  15. 60
  16. border
  17. 20
  18. white
  19. 11
  20. p
  21. <p class="star">
  22. No
  23. /*
  24. puts boxes in the middle
  25. white
  26. a class selector
  27. the later one
  28. border
  29. .note
  30. False
  31. 10
  32. 20
  33. makes headings and lists
  34. .css
  35. red
  36. a class selector
  37. No
  38. red
  39. JavaScript
  40. black

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