← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 464 · 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 of light is strongest in rgb(198, 112, 86)? (a) green (b) blue (c) red
  2. 2.✍️ Which sign goes between a property and its value? (a) : (b) - (c) = (d) ;
  3. 3.True or false: margin is space outside the border. (a) True (b) False
  4. 4.✍️ How many declarations (property: value pairs) are in this rule?
    body {
      font-weight: bold;
      background-color: yellow;
      color: red;
    }
  5. 5.🎯 What kind of selector is body? (a) an element selector (b) a class selector (c) an id selector
  6. 6.What does font-weight do? (a) centres a heading (b) makes the text bold (c) makes letters bigger (d) colours behind the text
  7. 7.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 80px;
      padding: 25px;
      border: 3px solid black;
      margin: 15px;
    }
  8. 8.🌈 In #rrggbb, which colour do the first two digits give? (a) red (b) blue (c) black (d) green
  9. 9.✍️ CSS declarations go inside which brackets? (a) < > (b) [ ] (c) ( ) (d) { }
  10. 10.What does font-family do? (a) makes letters bigger (b) colours behind the text (c) sets the letter colour (d) picks the font style
  11. 11.✍️ What value is given to background-color in this rule?
    .box {
      text-align: center;
      background-color: yellow;
      color: red;
      padding: 8px;
    }
    (a) 8px (b) background-color (c) yellow (d) 10px
  12. 12.✍️ What is the selector in this CSS rule?
    #top {
      font-style: italic;
      margin: 10px;
      font-size: 20px;
    }
    (a) font-style (b) li (c) #top (d) 10px
  13. 13.📱 max-width: 600px applies when the screen is ___. (a) exactly 1000px (b) 600px or narrower (c) turned off (d) 600px or wider
  14. 14.🎯 How many elements on a page should have the same id? (a) 5 (b) any number (c) 2 (d) 1
  15. 15.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 170px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  16. 16.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 12px;
      }
    }
  17. 17.📱 What does a media query check? (a) the battery level (b) the time of day (c) the page title (d) the screen width
  18. 18.What does justify-content: flex-start do? (a) equal gaps, none at ends (b) packs boxes at the end (c) packs boxes at the start (d) puts boxes in the middle
  19. 19.✍️ What is the selector in this CSS rule?
    .box {
      background-color: yellow;
      font-weight: bold;
      width: 300px;
    }
    (a) bold (b) .box (c) h2 (d) background-color
  20. 20.🎯 Which element does the selector h1 style? (a) <li class="box"> (b) <h2> (c) <div id="intro"> (d) <h1 class="box">
  21. 21.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 90px;
      padding: 15px;
      border: 3px solid black;
      margin: 0px;
    }
  22. 22.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 230px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 60px wide (no margins).
  23. 23.⚖️ What colour is the text of this element?
    <h2 class="big" id="intro">Hi</h2>
    CSS:
    #intro { color: blue; }
    #intro { color: white; }
    (a) yellow (b) purple (c) white (d) blue
  24. 24.✍️ What is the selector in this CSS rule?
    body {
      font-style: italic;
      width: 300px;
    }
    (a) 300px (b) font-style (c) body (d) .box
  25. 25.🎯 Which element does the selector p style? (a) <li id="logo"> (b) <p class="red"> (c) <h2 class="red"> (d) <h1>
  26. 26.🌈 In #rrggbb, which colour do the last two digits give? (a) green (b) blue (c) red (d) white
  27. 27.🧩 Which language checks a quiz answer? (a) CSS (b) JavaScript (c) HTML
  28. 28.⚖️ Which selector is the strongest? (a) a class selector (b) an id selector (c) an element selector
  29. 29.Which of these does HTML do? (a) shows a pop-up message (b) counts down a timer (c) puts a picture on a page (d) reacts to a button click
  30. 30.🧩 Which language reacts to a button click? (a) CSS (b) HTML (c) JavaScript
  31. 31.True or false: margin is the line round the box. (a) False (b) True
  32. 32.🌈 Which colour is rgb(0, 255, 255)? (a) cyan (b) red (c) bright green (d) white
  33. 33.True or false: CSS puts a picture on a page. (a) True (b) False
  34. 34.What does background-color do? (a) makes the text bold (b) sets the letter colour (c) centres a heading (d) colours behind the text
  35. 35.✍️ What is the selector in this CSS rule?
    h2 {
      text-align: center;
      width: 300px;
      border: 2px solid;
      background-color: yellow;
    }
    (a) text-align (b) 300px (c) h2 (d) h1
  36. 36.🖌️ Which CSS property makes the text bold? (a) background-color (b) font-weight (c) color (d) font-family
  37. 37.True or false: .menu is a class selector. (a) False (b) True
  38. 38.🧩 Which language sets colours and fonts? (a) CSS (b) HTML (c) JavaScript
  39. 39.🔍 Which is the odd one out? (a) reacts to a button click (b) counts down a timer (c) shows a pop-up message (d) makes a form box
  40. 40.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 40px;
      padding: 5px;
      border: 3px solid black;
      margin: 15px;
    }

Answer key

  1. red
  2. :
  3. True
  4. 3
  5. an element selector
  6. makes the text bold
  7. 166
  8. red
  9. { }
  10. picks the font style
  11. yellow
  12. #top
  13. 600px or narrower
  14. 1
  15. 70
  16. 16
  17. the screen width
  18. packs boxes at the start
  19. .box
  20. <h1 class="box">
  21. 126
  22. 50
  23. white
  24. body
  25. <p class="red">
  26. blue
  27. JavaScript
  28. an id selector
  29. puts a picture on a page
  30. JavaScript
  31. False
  32. cyan
  33. False
  34. colours behind the text
  35. h2
  36. font-weight
  37. True
  38. CSS
  39. makes a form box
  40. 86

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