← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 392 · 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 a media query check? (a) the screen width (b) the page title (c) the battery level (d) the time of day
  2. 2.What does justify-content: space-between do? (a) packs boxes at the start (b) packs boxes at the end (c) puts boxes in the middle (d) equal gaps, none at ends
  3. 3.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 22px;
      }
    }
    (a) No (b) Yes
  4. 4.🌈 Which colour is rgb(0, 0, 0)? (a) red (b) black (c) cyan (d) yellow
  5. 5.🌈 Which colour is rgb(0, 255, 0)? (a) magenta (b) yellow (c) bright green (d) black
  6. 6.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 160px;
      justify-content: center;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  7. 7.True or false: JavaScript rounds box corners. (a) True (b) False
  8. 8.🧩 Which language reacts to a button click? (a) CSS (b) HTML (c) JavaScript
  9. 9.🌈 Which colour of light is strongest in rgb(50, 166, 33)? (a) green (b) red (c) blue
  10. 10.📦 In the box model, which part is a solid or dotted edge? (a) border (b) padding (c) content (d) margin
  11. 11.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 26px;
      }
    }
    (a) No (b) Yes
  12. 12.What does background-color do? (a) picks the font style (b) sets the letter colour (c) colours behind the text (d) centres a heading
  13. 13.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 100px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  14. 14.True or false: CSS counts down a timer. (a) True (b) False
  15. 15.🌈 Which colour is #ffff00? (a) blue (b) yellow (c) red (d) white
  16. 16.🎯 Which element does the selector p style? (a) <h2 class="big"> (b) <h1> (c) <li id="logo"> (d) <p class="big">
  17. 17.🎯 Which element does the selector .star style? (a) <span class="note"> (b) <div class="star"> (c) <div class="menu"> (d) <div id="star">
  18. 18.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 20px;
      }
    }
    (a) Yes (b) No
  19. 19.🎯 Which element does the selector li style? (a) <li class="box"> (b) <div> (c) <p id="logo"> (d) <span class="box">
  20. 20.True or false: .card is an element selector. (a) True (b) False
  21. 21.📱 min-width: 800px applies when the screen is ___. (a) 800px or wider (b) turned off (c) exactly 100px (d) 800px or narrower
  22. 22.✍️ Which sign goes between a property and its value? (a) = (b) ; (c) - (d) :
  23. 23.✍️ Which property is set to italic in this rule?
    body {
      border: 2px solid;
      font-style: italic;
      font-weight: bold;
    }
    (a) italic (b) font-style (c) color (d) font-size
  24. 24.🖌️ How big is the text, in px?
    h2 {
      background-color: purple;
      text-align: center;
      color: black;
      font-size: 24px;
    }
  25. 25.True or false: .note is a class selector. (a) True (b) False
  26. 26.✍️ In color: blue; which part is the property? (a) color (b) blue (c) : (d) ;
  27. 27.🎯 Which element does the selector .star style? (a) <div class="note"> (b) <li class="star"> (c) <li id="star"> (d) <li class="menu">
  28. 28.✍️ How many declarations (property: value pairs) are in this rule?
    #top {
      font-size: 20px;
    }
  29. 29.✍️ What value is given to font-size in this rule?
    p {
      background-color: yellow;
      width: 300px;
      color: red;
      font-size: 20px;
    }
    (a) yellow (b) 20px (c) center (d) font-size
  30. 30.🎨 Which tag connects an outside CSS file? (a) <a> (b) <css> (c) <img> (d) <link>
  31. 31.What does justify-content: flex-end do? (a) packs boxes at the start (b) equal gaps, none at ends (c) puts boxes in the middle (d) packs boxes at the end
  32. 32.🌈 Which hex code is white? (a) #0000ff (b) #ffffff (c) #ff0000 (d) #000000
  33. 33.🖌️ What colour is behind the letters?
    li {
      background-color: white;
      font-size: 16px;
      text-align: left;
      color: green;
    }
    (a) white (b) red (c) green
  34. 34.✍️ What value is given to background-color in this rule?
    p {
      font-weight: bold;
      width: 300px;
      background-color: yellow;
      font-size: 20px;
    }
    (a) yellow (b) 10px (c) background-color (d) 8px
  35. 35.✍️ How does a CSS comment start? (a) /* (b) // (c) # (d) <!--
  36. 36.🖌️ How big is the text, in px?
    li {
      font-size: 32px;
      color: yellow;
      text-align: right;
      background-color: orange;
    }
  37. 37.🌈 In #6a0000 the red part is the hex number 6a. What is it as a normal number?
  38. 38.Which of these does HTML do? (a) changes the page live (b) checks a quiz answer (c) makes headings and lists (d) shows a pop-up message
  39. 39.🎯 Which element does the selector span style? (a) <h1 class="star"> (b) <span class="star"> (c) <p> (d) <h2 id="hero">
  40. 40.True or false: .big is a class selector. (a) True (b) False

Answer key

  1. the screen width
  2. equal gaps, none at ends
  3. Yes
  4. black
  5. bright green
  6. 40
  7. False
  8. JavaScript
  9. green
  10. border
  11. Yes
  12. colours behind the text
  13. 20
  14. False
  15. yellow
  16. <p class="big">
  17. <div class="star">
  18. No
  19. <li class="box">
  20. False
  21. 800px or wider
  22. :
  23. font-style
  24. 24
  25. True
  26. color
  27. <li class="star">
  28. 1
  29. 20px
  30. <link>
  31. packs boxes at the end
  32. #ffffff
  33. white
  34. yellow
  35. /*
  36. 32
  37. 106
  38. makes headings and lists
  39. <span class="star">
  40. True

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