← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 361 · 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 value is given to padding in this rule?
    p {
      border: 2px solid;
      padding: 8px;
      color: red;
      width: 300px;
    }
    (a) padding (b) 2px solid (c) bold (d) 8px
  2. 2.🖌️ Which CSS property centres a heading? (a) text-align (b) color (c) font-weight (d) font-size
  3. 3.Which of these is padding? (a) the text or picture (b) the line round the box (c) a solid or dotted edge (d) space inside the border
  4. 4.✍️ In color: blue; which part is the property? (a) : (b) blue (c) ; (d) color
  5. 5.True or false: HTML changes the text size. (a) False (b) True
  6. 6.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) the later one (c) the first one (d) neither
  7. 7.✍️ In color: blue; which part is the value? (a) blue (b) : (c) ; (d) color
  8. 8.✍️ What is the selector in this CSS rule?
    body {
      border: 2px solid;
      font-size: 20px;
    }
    (a) border (b) .box (c) 20px (d) body
  9. 9.🎯 Which element does the selector h2 style? (a) <li> (b) <h2 class="box"> (c) <div class="box"> (d) <span id="main">
  10. 10.What does justify-content: space-between 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
  11. 11.✍️ How many declarations (property: value pairs) are in this rule?
    body {
      text-align: center;
      font-style: italic;
      font-size: 20px;
      color: red;
    }
  12. 12.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 100px;
      padding: 20px;
      border: 3px solid black;
      margin: 5px;
    }
  13. 13.Which of these does CSS do? (a) reacts to a button click (b) lays out the page (c) makes headings and lists (d) changes the page live
  14. 14.🌈 What is the biggest number one colour can have in rgb()? (a) 255 (b) 1000 (c) 100 (d) 99
  15. 15.✍️ Which property is set to italic in this rule?
    h2 {
      font-style: italic;
      background-color: yellow;
      font-weight: bold;
    }
    (a) color (b) italic (c) font-size (d) font-style
  16. 16.True or false: #end is an id selector. (a) False (b) True
  17. 17.✍️ What value is given to width in this rule?
    body {
      border: 2px solid;
      width: 300px;
    }
    (a) red (b) 300px (c) width (d) italic
  18. 18.🎯 Which sign starts an id selector? (a) . (b) # (c) @ (d) &
  19. 19.⚖️ What colour is the text of this element?
    <h1 class="box" id="hero">Hi</h1>
    CSS:
    #hero { color: yellow; }
    #hero { color: purple; }
    (a) black (b) yellow (c) purple (d) red
  20. 20.⚖️ What colour is the text of this element?
    <h1 class="note" id="hero">Hi</h1>
    CSS:
    h1 { color: yellow; }
    .note { color: white; }
    (a) green (b) yellow (c) white (d) red
  21. 21.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      padding: 8px;
      border: 2px solid;
    }
  22. 22.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 230px;
      justify-content: center;
    }
    Inside are 3 boxes, each 50px wide (no margins).
  23. 23.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) turned off (c) exactly 100px (d) 800px or wider
  24. 24.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 230px;
      padding: 10px;
      border: 5px solid black;
      margin: 15px;
    }
  25. 25.Which of these is the border? (a) the text or picture (b) the gap to other boxes (c) space inside the border (d) a solid or dotted edge
  26. 26.🎯 What kind of selector is .card? (a) a class selector (b) an id selector (c) an element selector
  27. 27.🌈 In #00a800 the green part is the hex number a8. What is it as a normal number?
  28. 28.✍️ Which property is set to 8px in this rule?
    #top {
      padding: 8px;
      border: 2px solid;
      font-size: 20px;
    }
    (a) font-weight (b) padding (c) border (d) 8px
  29. 29.🖌️ Where does the text sit on its line?
    h1 {
      background-color: green;
      text-align: left;
      font-size: 16px;
      color: blue;
    }
    (a) on the left (b) in the middle (c) on the right
  30. 30.✍️ What value is given to text-align in this rule?
    h1 {
      font-style: italic;
      border: 2px solid;
      text-align: center;
    }
    (a) center (b) yellow (c) 10px (d) text-align
  31. 31.🖌️ Which CSS property makes the text bold? (a) font-family (b) text-align (c) font-weight (d) font-size
  32. 32.🧩 Which language sets colours and fonts? (a) JavaScript (b) HTML (c) CSS
  33. 33.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 200px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 50px wide (no margins).
  34. 34.⚖️ What colour is the text of this element?
    <p class="note" id="intro">Hi</p>
    CSS:
    #intro { color: purple; }
    p { color: white; }
    (a) white (b) purple (c) red (d) black
  35. 35.📱 max-width: 600px applies when the screen is ___. (a) 600px or wider (b) exactly 1000px (c) turned off (d) 600px or narrower
  36. 36.True or false: padding is the text or picture. (a) True (b) False
  37. 37.🎯 What kind of selector is #end? (a) an element selector (b) a class selector (c) an id selector
  38. 38.Which of these does HTML do? (a) shows a pop-up message (b) sets colours and fonts (c) changes the text size (d) gives the page structure
  39. 39.⚖️ What colour is the text of this element?
    <p class="box" id="logo">Hi</p>
    CSS:
    p { color: blue; }
    p { color: black; }
    (a) blue (b) black (c) green (d) red
  40. 40.🌈 Which colour is #000000? (a) white (b) black (c) blue (d) magenta

Answer key

  1. 8px
  2. text-align
  3. space inside the border
  4. color
  5. False
  6. the later one
  7. blue
  8. body
  9. <h2 class="box">
  10. equal gaps, none at ends
  11. 4
  12. 156
  13. lays out the page
  14. 255
  15. font-style
  16. True
  17. 300px
  18. #
  19. purple
  20. white
  21. 2
  22. 40
  23. 800px or wider
  24. 260
  25. a solid or dotted edge
  26. a class selector
  27. 168
  28. padding
  29. on the left
  30. center
  31. font-weight
  32. CSS
  33. 50
  34. purple
  35. 600px or narrower
  36. False
  37. an id selector
  38. gives the page structure
  39. black
  40. black

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