← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 581 · 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 hex code is bright green? (a) #00ff00 (b) #0000ff (c) #ffff00 (d) #ff0000
  2. 2.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 12px;
      }
    }
  3. 3.✍️ What is the selector in this CSS rule?
    .box {
      color: red;
      font-size: 20px;
      padding: 8px;
    }
    (a) 20px (b) .box (c) color (d) h2
  4. 4.⚖️ Which selector is the weakest? (a) a class selector (b) an element selector (c) an id selector
  5. 5.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 350px;
      justify-content: flex-end;
    }
    Inside are 3 boxes, each 100px wide (no margins).
  6. 6.True or false: .card is an id selector. (a) True (b) False
  7. 7.🖌️ What colour is behind the letters?
    p {
      background-color: orange;
      font-size: 12px;
      text-align: left;
      color: green;
    }
    (a) green (b) orange (c) black
  8. 8.🔍 Which is the odd one out? (a) adds space around boxes (b) checks a quiz answer (c) lays out the page (d) sets colours and fonts
  9. 9.⚖️ What colour is the text of this element?
    <h2 class="box" id="hero">Hi</h2>
    CSS:
    .box { color: purple; }
    .box { color: red; }
    (a) purple (b) red (c) orange (d) yellow
  10. 10.📱 max-width: 600px applies when the screen is ___. (a) turned off (b) exactly 1000px (c) 600px or wider (d) 600px or narrower
  11. 11.🖌️ Where does the text sit on its line?
    h1 {
      text-align: right;
      color: red;
      font-size: 32px;
      background-color: purple;
    }
    (a) on the right (b) in the middle (c) on the left
  12. 12.🖌️ How big is the text, in px?
    h1 {
      font-size: 36px;
      color: red;
      text-align: left;
      background-color: blue;
    }
  13. 13.✍️ What is the selector in this CSS rule?
    li {
      border: 2px solid;
      text-align: center;
      font-size: 20px;
      width: 300px;
    }
    (a) border (b) center (c) body (d) li
  14. 14.True or false: HTML lays out the page. (a) True (b) False
  15. 15.True or false: HTML checks a quiz answer. (a) True (b) False
  16. 16.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 320px;
      justify-content: center;
    }
    Inside are 3 boxes, each 60px wide (no margins).
  17. 17.🔍 Which is the odd one out? (a) sets colours and fonts (b) adds space around boxes (c) makes a link (d) changes the text size
  18. 18.✍️ What value is given to font-weight in this rule?
    .note {
      text-align: center;
      font-weight: bold;
    }
    (a) bold (b) font-weight (c) 300px (d) 2px solid
  19. 19.📱 What does a media query check? (a) the page title (b) the screen width (c) the time of day (d) the battery level
  20. 20.True or false: HTML gives the page structure. (a) False (b) True
  21. 21.🧩 Which language makes a link? (a) JavaScript (b) HTML (c) CSS
  22. 22.True or false: padding is the gap round content. (a) False (b) True
  23. 23.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 18px;
      }
    }
  24. 24.⚖️ What colour is the text of this element?
    <p class="big" id="main">Hi</p>
    CSS:
    #main { color: white; }
    p { color: yellow; }
    .big { color: purple; }
    (a) purple (b) yellow (c) orange (d) white
  25. 25.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 200px;
      justify-content: center;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  26. 26.🖌️ Which CSS property sets the letter colour? (a) font-family (b) font-size (c) background-color (d) color
  27. 27.🎯 Which element does the selector h1 style? (a) <li class="big"> (b) <div id="top"> (c) <h2> (d) <h1 class="big">
  28. 28.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 190px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 80px wide (no margins).
  29. 29.🖌️ Which CSS property makes letters bigger? (a) font-size (b) color (c) font-family (d) background-color
  30. 30.🌈 Which colour is rgb(0, 0, 0)? (a) red (b) black (c) magenta (d) bright green
  31. 31.⚖️ What colour is the text of this element?
    <p class="big" id="intro">Hi</p>
    CSS:
    p { color: green; }
    .big { color: red; }
    (a) green (b) orange (c) purple (d) red
  32. 32.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 6px;
      }
    }
  33. 33.🌈 Which hex code is white? (a) #ffff00 (b) #ffffff (c) #00ffff (d) #0000ff
  34. 34.🎨 Which tag connects an outside CSS file? (a) <link> (b) <css> (c) <img> (d) <a>
  35. 35.🌈 Which hex code is blue? (a) #00ffff (b) #000000 (c) #ff0000 (d) #0000ff
  36. 36.✍️ Which property is set to 8px in this rule?
    p {
      padding: 8px;
      font-weight: bold;
      margin: 10px;
    }
    (a) padding (b) font-weight (c) 8px (d) border
  37. 37.True or false: .star is an id selector. (a) False (b) True
  38. 38.✍️ Which sign ends each CSS declaration? (a) ; (b) . (c) , (d) :
  39. 39.✍️ What value is given to text-align in this rule?
    #top {
      text-align: center;
      width: 300px;
    }
    (a) yellow (b) 10px (c) center (d) text-align
  40. 40.⚖️ What colour is the text of this element?
    <h1 class="box" id="hero">Hi</h1>
    CSS:
    #hero { color: orange; }
    #hero { color: yellow; }
    (a) white (b) yellow (c) red (d) orange

Answer key

  1. #00ff00
  2. 16
  3. .box
  4. an element selector
  5. 50
  6. False
  7. orange
  8. checks a quiz answer
  9. red
  10. 600px or narrower
  11. on the right
  12. 36
  13. li
  14. False
  15. False
  16. 70
  17. makes a link
  18. bold
  19. the screen width
  20. True
  21. HTML
  22. True
  23. 18
  24. white
  25. 50
  26. color
  27. <h1 class="big">
  28. 30
  29. font-size
  30. black
  31. red
  32. 6
  33. #ffffff
  34. <link>
  35. #0000ff
  36. padding
  37. False
  38. ;
  39. center
  40. yellow

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