← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 446 · 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.True or false: the border is the gap to other boxes. (a) False (b) True
  2. 2.🖌️ What colour are the letters?
    h1 {
      background-color: green;
      color: black;
      font-size: 40px;
      text-align: left;
    }
    (a) blue (b) green (c) black
  3. 3.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 10px;
      }
    }
    (a) Yes (b) No
  4. 4.🎨 Which tag holds CSS inside the head? (a) <script> (b) <style> (c) <css> (d) <body>
  5. 5.🎯 Which sign starts an id selector? (a) . (b) & (c) # (d) @
  6. 6.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 310px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 60px wide (no margins).
  7. 7.🎯 Which sign starts a class selector? (a) @ (b) # (c) & (d) .
  8. 8.🔍 Which is the odd one out? (a) makes headings and lists (b) changes the page live (c) shows a pop-up message (d) checks a quiz answer
  9. 9.✍️ Which sign goes between a property and its value? (a) ; (b) - (c) = (d) :
  10. 10.What does justify-content: flex-start do? (a) packs boxes at the end (b) equal gaps, none at ends (c) packs boxes at the start (d) puts boxes in the middle
  11. 11.📦 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: 15px;
      border: 5px solid black;
      margin: 5px;
    }
  12. 12.🌈 Which hex code is yellow? (a) #00ffff (b) #00ff00 (c) #0000ff (d) #ffff00
  13. 13.🧩 Which language makes a link? (a) HTML (b) JavaScript (c) CSS
  14. 14.True or false: body is an element selector. (a) True (b) False
  15. 15.True or false: JavaScript rounds box corners. (a) True (b) False
  16. 16.🖌️ What colour is behind the letters?
    li {
      background-color: yellow;
      text-align: right;
      color: red;
      font-size: 24px;
    }
    (a) red (b) yellow (c) purple
  17. 17.🔍 Which is the odd one out? (a) changes the page live (b) makes headings and lists (c) makes a link (d) gives the page structure
  18. 18.✍️ What is the selector in this CSS rule?
    h1 {
      width: 300px;
      font-size: 20px;
      font-weight: bold;
    }
    (a) h1 (b) width (c) p (d) 20px
  19. 19.✍️ How does a CSS comment start? (a) <!-- (b) # (c) /* (d) //
  20. 20.🖌️ Where does the text sit on its line?
    h1 {
      background-color: purple;
      color: orange;
      text-align: left;
      font-size: 20px;
    }
    (a) in the middle (b) on the left (c) on the right
  21. 21.🌈 Which colour of light is strongest in rgb(59, 192, 44)? (a) green (b) blue (c) red
  22. 22.True or false: .big is a class selector. (a) True (b) False
  23. 23.🎯 Which CSS selector matches this element?
    <li class="big" id="intro">Hello</li>
    (a) li (b) #main (c) div (d) .intro
  24. 24.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      font-style: italic;
      padding: 8px;
      width: 300px;
    }
  25. 25.✍️ CSS declarations go inside which brackets? (a) < > (b) ( ) (c) [ ] (d) { }
  26. 26.🎨 Which attribute adds CSS inside one tag? (a) href (b) src (c) style (d) alt
  27. 27.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      color: red;
      margin: 10px;
      text-align: center;
    }
  28. 28.🌈 Which colour is rgb(0, 0, 255)? (a) yellow (b) magenta (c) blue (d) red
  29. 29.⚖️ What colour is the text of this element?
    <p class="box" id="hero">Hi</p>
    CSS:
    #hero { color: white; }
    p { color: orange; }
    .box { color: blue; }
    (a) orange (b) blue (c) white (d) green
  30. 30.True or false: #end is an id selector. (a) True (b) False
  31. 31.🎯 Which CSS selector matches this element?
    <p class="box" id="top">Hello</p>
    (a) h1 (b) .top (c) #intro (d) p
  32. 32.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) the first one (c) the later one (d) neither
  33. 33.🧩 Which language lays out the page? (a) CSS (b) JavaScript (c) HTML
  34. 34.True or false: #logo is a class selector. (a) True (b) False
  35. 35.🌈 What is the biggest number one colour can have in rgb()? (a) 100 (b) 1000 (c) 99 (d) 255
  36. 36.📱 max-width: 600px applies when the screen is ___. (a) 600px or wider (b) 600px or narrower (c) exactly 1000px (d) turned off
  37. 37.⚖️ Which selector is the weakest? (a) an id selector (b) a class selector (c) an element selector
  38. 38.✍️ What value is given to padding in this rule?
    p {
      padding: 8px;
      width: 300px;
      background-color: yellow;
      font-size: 20px;
    }
    (a) 2px solid (b) bold (c) padding (d) 8px
  39. 39.True or false: padding is space outside the border. (a) False (b) True
  40. 40.🖌️ Which CSS property picks the font style? (a) background-color (b) font-weight (c) font-family (d) color

Answer key

  1. False
  2. black
  3. Yes
  4. <style>
  5. #
  6. 70
  7. .
  8. makes headings and lists
  9. :
  10. packs boxes at the start
  11. 180
  12. #ffff00
  13. HTML
  14. True
  15. False
  16. yellow
  17. changes the page live
  18. h1
  19. /*
  20. on the left
  21. green
  22. True
  23. li
  24. 3
  25. { }
  26. style
  27. 3
  28. blue
  29. white
  30. True
  31. p
  32. the later one
  33. CSS
  34. False
  35. 255
  36. 600px or narrower
  37. an element selector
  38. 8px
  39. False
  40. font-family

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