← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 545 · 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 flexbox property sets space between boxes? (a) display: flex (b) flex-direction (c) gap (d) align-items
  2. 2.🎯 Which sign starts an id selector? (a) # (b) @ (c) & (d) .
  3. 3.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      color: red;
    }
  4. 4.🎨 Which tag holds CSS inside the head? (a) <css> (b) <script> (c) <style> (d) <body>
  5. 5.True or false: margin is the gap round content. (a) False (b) True
  6. 6.🌈 Which colour of light is strongest in rgb(21, 156, 117)? (a) blue (b) green (c) red
  7. 7.🌈 Which colour of light is strongest in rgb(180, 114, 53)? (a) blue (b) red (c) green
  8. 8.🌈 In #rrggbb, which colour do the first two digits give? (a) red (b) green (c) blue (d) black
  9. 9.⚖️ What colour is the text of this element?
    <h1 class="big" id="main">Hi</h1>
    CSS:
    h1 { color: green; }
    .big { color: white; }
    #main { color: purple; }
    (a) purple (b) white (c) green (d) blue
  10. 10.📦 In the box model, which part is a solid or dotted edge? (a) padding (b) border (c) content (d) margin
  11. 11.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) 800px or wider (c) turned off (d) exactly 100px
  12. 12.🖌️ Where does the text sit on its line?
    h2 {
      background-color: yellow;
      text-align: left;
      font-size: 32px;
      color: white;
    }
    (a) in the middle (b) on the left (c) on the right
  13. 13.✍️ What is the selector in this CSS rule?
    p {
      font-size: 20px;
      margin: 10px;
    }
    (a) p (b) font-size (c) .note (d) 10px
  14. 14.💪 Which justify-content value packs boxes at the start? (a) center (b) flex-start (c) flex-end (d) space-between
  15. 15.True or false: .card is an element selector. (a) False (b) True
  16. 16.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 140px;
      padding: 20px;
      border: 4px solid black;
      margin: 15px;
    }
  17. 17.🌈 Which hex code is red? (a) #000000 (b) #ffffff (c) #00ff00 (d) #ff0000
  18. 18.✍️ In color: blue; which part is the value? (a) color (b) : (c) blue (d) ;
  19. 19.What does background-color do? (a) centres a heading (b) sets the letter colour (c) makes letters bigger (d) colours behind the text
  20. 20.True or false: padding is space outside the border. (a) True (b) False
  21. 21.🌈 Which hex code is yellow? (a) #ffff00 (b) #00ff00 (c) #000000 (d) #ff00ff
  22. 22.⚖️ What colour is the text of this element?
    <h2 class="big" id="end">Hi</h2>
    CSS:
    h2 { color: blue; }
    .big { color: green; }
    (a) yellow (b) green (c) blue (d) orange
  23. 23.🧩 Which language adds space around boxes? (a) HTML (b) JavaScript (c) CSS
  24. 24.✍️ Which property is set to 20px in this rule?
    #top {
      text-align: center;
      font-size: 20px;
      width: 300px;
      padding: 8px;
    }
    (a) 20px (b) font-size (c) text-align (d) background-color
  25. 25.⚖️ Which selector is the strongest? (a) a class selector (b) an id selector (c) an element selector
  26. 26.✍️ What value is given to color in this rule?
    p {
      color: red;
      background-color: yellow;
      font-weight: bold;
    }
    (a) 20px (b) center (c) color (d) red
  27. 27.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the first one (b) neither (c) the shorter one (d) the later one
  28. 28.🌈 Which colour of light is strongest in rgb(129, 176, 112)? (a) red (b) green (c) blue
  29. 29.🌈 Which colour is rgb(255, 255, 255)? (a) white (b) blue (c) yellow (d) red
  30. 30.🎯 What kind of selector is p? (a) a class selector (b) an id selector (c) an element selector
  31. 31.🌈 Which colour is #000000? (a) bright green (b) black (c) magenta (d) white
  32. 32.🧩 Which language makes headings and lists? (a) JavaScript (b) HTML (c) CSS
  33. 33.🌈 Which colour is rgb(255, 0, 255)? (a) red (b) black (c) white (d) magenta
  34. 34.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 14px;
      }
    }
    (a) No (b) Yes
  35. 35.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 210px;
      padding: 5px;
      border: 4px solid black;
      margin: 5px;
    }
  36. 36.✍️ CSS declarations go inside which brackets? (a) [ ] (b) < > (c) ( ) (d) { }
  37. 37.🎯 What kind of selector is .menu? (a) a class selector (b) an id selector (c) an element selector
  38. 38.⚖️ What colour is the text of this element?
    <h2 class="big" id="hero">Hi</h2>
    CSS:
    h2 { color: purple; }
    h2 { color: blue; }
    (a) yellow (b) purple (c) blue (d) green
  39. 39.Which of these does JavaScript do? (a) makes a form box (b) checks a quiz answer (c) makes a link (d) makes headings and lists
  40. 40.✍️ Which property is set to 20px in this rule?
    p {
      background-color: yellow;
      width: 300px;
      font-size: 20px;
      color: red;
    }
    (a) text-align (b) 20px (c) font-size (d) background-color

Answer key

  1. gap
  2. #
  3. 1
  4. <style>
  5. False
  6. green
  7. red
  8. red
  9. purple
  10. border
  11. 800px or wider
  12. on the left
  13. p
  14. flex-start
  15. False
  16. 188
  17. #ff0000
  18. blue
  19. colours behind the text
  20. False
  21. #ffff00
  22. green
  23. CSS
  24. font-size
  25. an id selector
  26. red
  27. the later one
  28. green
  29. white
  30. an element selector
  31. black
  32. HTML
  33. magenta
  34. No
  35. 228
  36. { }
  37. a class selector
  38. blue
  39. checks a quiz answer
  40. font-size

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