← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 765 · 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: #end is an element selector. (a) False (b) True
  2. 2.Which of these does CSS do? (a) lays out the page (b) shows a pop-up message (c) gives the page structure (d) puts a picture on a page
  3. 3.True or false: padding is space inside the border. (a) False (b) True
  4. 4.🖌️ What colour are the letters?
    h2 {
      text-align: center;
      background-color: green;
      font-size: 36px;
      color: purple;
    }
    (a) purple (b) black (c) green
  5. 5.✍️ How does a CSS comment start? (a) /* (b) // (c) # (d) <!--
  6. 6.✍️ Which property is set to 10px in this rule?
    h1 {
      margin: 10px;
      font-size: 20px;
    }
    (a) font-weight (b) margin (c) padding (d) 10px
  7. 7.🌈 Which colour is #00ffff? (a) red (b) white (c) magenta (d) cyan
  8. 8.True or false: .big is an id selector. (a) False (b) True
  9. 9.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 190px;
      padding: 25px;
      border: 2px solid black;
      margin: 10px;
    }
  10. 10.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the first one (b) the later one (c) the shorter one (d) neither
  11. 11.🎯 Which sign starts an id selector? (a) # (b) @ (c) . (d) &
  12. 12.Which of these is padding? (a) a solid or dotted edge (b) space outside the border (c) the line round the box (d) space inside the border
  13. 13.🌈 Which colour is rgb(255, 255, 0)? (a) white (b) yellow (c) black (d) bright green
  14. 14.✍️ What value is given to padding in this rule?
    p {
      font-size: 20px;
      padding: 8px;
      text-align: center;
    }
    (a) 8px (b) padding (c) 2px solid (d) bold
  15. 15.🎯 Which element does the selector #end style? (a) <h2 id="end"> (b) <h2 id="hero"> (c) <li class="star"> (d) <h2 class="end">
  16. 16.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 18px;
      }
    }
  17. 17.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      font-weight: bold;
      padding: 8px;
      font-size: 20px;
      border: 2px solid;
    }
  18. 18.✍️ Which property is set to 2px solid in this rule?
    body {
      border: 2px solid;
      font-weight: bold;
    }
    (a) 2px solid (b) font-style (c) width (d) border
  19. 19.🌈 Which colour is rgb(0, 0, 255)? (a) magenta (b) black (c) white (d) blue
  20. 20.⚖️ What colour is the text of this element?
    <p class="menu" id="logo">Hi</p>
    CSS:
    #logo { color: white; }
    #logo { color: orange; }
    (a) orange (b) white (c) blue (d) red
  21. 21.✍️ CSS declarations go inside which brackets? (a) [ ] (b) { } (c) < > (d) ( )
  22. 22.True or false: HTML puts a picture on a page. (a) True (b) False
  23. 23.🌈 Which colour is #ffff00? (a) white (b) magenta (c) yellow (d) blue
  24. 24.Which of these does CSS do? (a) makes a link (b) adds space around boxes (c) makes a form box (d) makes headings and lists
  25. 25.🖌️ What colour are the letters?
    p {
      text-align: center;
      background-color: green;
      color: black;
      font-size: 12px;
    }
    (a) green (b) black (c) orange
  26. 26.🔍 Which is the odd one out? (a) makes a form box (b) gives the page structure (c) puts a picture on a page (d) changes the page live
  27. 27.🖌️ Where does the text sit on its line?
    h1 {
      color: red;
      font-size: 16px;
      background-color: black;
      text-align: left;
    }
    (a) in the middle (b) on the left (c) on the right
  28. 28.🎯 Which CSS selector matches this element?
    <h2 class="red" id="logo">Hello</h2>
    (a) #red (b) .logo (c) li (d) h2
  29. 29.🖌️ Where does the text sit on its line?
    p {
      font-size: 20px;
      background-color: yellow;
      color: orange;
      text-align: right;
    }
    (a) on the left (b) on the right (c) in the middle
  30. 30.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 80px;
      padding: 30px;
      border: 3px solid black;
      margin: 15px;
    }
  31. 31.⚖️ What colour is the text of this element?
    <p class="star" id="top">Hi</p>
    CSS:
    p { color: red; }
    p { color: white; }
    (a) blue (b) red (c) white (d) black
  32. 32.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 400px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 80px wide (no margins).
  33. 33.✍️ How many declarations (property: value pairs) are in this rule?
    #top {
      font-style: italic;
    }
  34. 34.🎯 Which CSS selector matches this element?
    <h1 class="big" id="intro">Hello</h1>
    (a) h2 (b) #big (c) .intro (d) .big
  35. 35.🎯 What kind of selector is p? (a) an element selector (b) an id selector (c) a class selector
  36. 36.🧩 Which language lays out the page? (a) CSS (b) HTML (c) JavaScript
  37. 37.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 120px;
      padding: 10px;
      border: 4px solid black;
      margin: 20px;
    }
  38. 38.⚖️ What colour is the text of this element?
    <h1 class="menu" id="intro">Hi</h1>
    CSS:
    #intro { color: yellow; }
    #intro { color: orange; }
    (a) orange (b) yellow (c) black (d) purple
  39. 39.🎯 Which element does the selector p style? (a) <h2 class="big"> (b) <li id="logo"> (c) <h1> (d) <p class="big">
  40. 40.✍️ What is the selector in this CSS rule?
    .note {
      font-size: 20px;
      margin: 10px;
      font-weight: bold;
    }
    (a) 10px (b) font-size (c) #top (d) .note

Answer key

  1. False
  2. lays out the page
  3. True
  4. purple
  5. /*
  6. margin
  7. cyan
  8. False
  9. 264
  10. the later one
  11. #
  12. space inside the border
  13. yellow
  14. 8px
  15. <h2 id="end">
  16. 24
  17. 4
  18. border
  19. blue
  20. orange
  21. { }
  22. True
  23. yellow
  24. adds space around boxes
  25. black
  26. changes the page live
  27. on the left
  28. h2
  29. on the right
  30. 176
  31. white
  32. 80
  33. 1
  34. .big
  35. an element selector
  36. CSS
  37. 188
  38. orange
  39. <p class="big">
  40. .note

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