← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 623 · 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.🌈 Which colour is rgb(0, 255, 255)? (a) magenta (b) red (c) blue (d) cyan
  2. 2.True or false: JavaScript makes headings and lists. (a) True (b) False
  3. 3.⚖️ What colour is the text of this element?
    <h2 class="box" id="main">Hi</h2>
    CSS:
    h2 { color: purple; }
    h2 { color: black; }
    (a) white (b) blue (c) purple (d) black
  4. 4.True or false: JavaScript rounds box corners. (a) False (b) True
  5. 5.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 80px;
      padding: 10px;
      border: 1px solid black;
      margin: 0px;
    }
  6. 6.⚖️ 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
  7. 7.🖌️ Which CSS property makes letters bigger? (a) color (b) font-size (c) font-weight (d) font-family
  8. 8.⚖️ Which selector is the weakest? (a) an element selector (b) an id selector (c) a class selector
  9. 9.True or false: li is an element selector. (a) False (b) True
  10. 10.Which of these is margin? (a) the text or picture (b) the gap to other boxes (c) space inside the border (d) a solid or dotted edge
  11. 11.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 18px;
      }
    }
    (a) No (b) Yes
  12. 12.🌈 Which hex code is red? (a) #00ff00 (b) #ffff00 (c) #0000ff (d) #ff0000
  13. 13.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 150px;
      padding: 5px;
      border: 4px solid black;
      margin: 20px;
    }
  14. 14.✍️ What value is given to background-color in this rule?
    #top {
      width: 300px;
      font-style: italic;
      background-color: yellow;
    }
    (a) background-color (b) 8px (c) yellow (d) 10px
  15. 15.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) turned off (c) 800px or wider (d) exactly 100px
  16. 16.Which of these is padding? (a) a solid or dotted edge (b) space outside the border (c) space inside the border (d) the line round the box
  17. 17.💪 Which flexbox property picks row or column? (a) justify-content (b) display: flex (c) flex-direction (d) gap
  18. 18.🌈 Which colour is rgb(255, 255, 255)? (a) blue (b) white (c) black (d) yellow
  19. 19.🌈 Which hex code is bright green? (a) #00ff00 (b) #00ffff (c) #0000ff (d) #ffffff
  20. 20.🌈 In #rrggbb, which colour do the last two digits give? (a) blue (b) green (c) red (d) white
  21. 21.🎯 Which sign starts a class selector? (a) # (b) . (c) @ (d) &
  22. 22.What does text-align do? (a) makes the text bold (b) picks the font style (c) colours behind the text (d) centres a heading
  23. 23.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 40px;
      padding: 5px;
      border: 5px solid black;
      margin: 10px;
    }
  24. 24.Which of these does JavaScript do? (a) rounds box corners (b) sets colours and fonts (c) checks a quiz answer (d) makes a link
  25. 25.🌈 Hex digits go 0 to 9, then A to which letter? (a) J (b) G (c) F (d) Z
  26. 26.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 8px;
      }
    }
  27. 27.🖌️ Which CSS property colours behind the text? (a) background-color (b) font-weight (c) text-align (d) font-family
  28. 28.🌈 Which hex code is yellow? (a) #000000 (b) #ffff00 (c) #00ff00 (d) #ff0000
  29. 29.⚖️ What colour is the text of this element?
    <h1 class="big" id="logo">Hi</h1>
    CSS:
    .big { color: black; }
    .big { color: white; }
    (a) purple (b) white (c) green (d) black
  30. 30.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 30px;
      }
    }
  31. 31.🌈 Which colour is #00ff00? (a) red (b) magenta (c) bright green (d) white
  32. 32.🎯 Which CSS selector matches this element?
    <li class="red" id="hero">Hello</li>
    (a) .box (b) li (c) #red (d) div
  33. 33.⚖️ What colour is the text of this element?
    <p class="star" id="top">Hi</p>
    CSS:
    #top { color: white; }
    #top { color: green; }
    (a) green (b) blue (c) black (d) white
  34. 34.⚖️ What colour is the text of this element?
    <h2 class="menu" id="hero">Hi</h2>
    CSS:
    #hero { color: white; }
    #hero { color: yellow; }
    (a) white (b) yellow (c) blue (d) orange
  35. 35.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      font-style: italic;
    }
  36. 36.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 90px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  37. 37.True or false: p is a class selector. (a) False (b) True
  38. 38.🖌️ Which CSS property centres a heading? (a) text-align (b) background-color (c) font-weight (d) font-size
  39. 39.True or false: margin is space inside the border. (a) False (b) True
  40. 40.🧩 Which language counts down a timer? (a) HTML (b) CSS (c) JavaScript

Answer key

  1. cyan
  2. False
  3. black
  4. False
  5. 102
  6. the later one
  7. font-size
  8. an element selector
  9. True
  10. the gap to other boxes
  11. Yes
  12. #ff0000
  13. 208
  14. yellow
  15. 800px or wider
  16. space inside the border
  17. flex-direction
  18. white
  19. #00ff00
  20. blue
  21. .
  22. centres a heading
  23. 80
  24. checks a quiz answer
  25. F
  26. 12
  27. background-color
  28. #ffff00
  29. white
  30. 24
  31. bright green
  32. li
  33. green
  34. yellow
  35. 1
  36. 10
  37. False
  38. text-align
  39. False
  40. JavaScript

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