← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 932 · 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 CSS property centres a heading? (a) color (b) text-align (c) font-family (d) background-color
  2. 2.True or false: padding is the gap round content. (a) True (b) False
  3. 3.🎯 Which CSS selector matches this element?
    <div class="big" id="top">Hello</div>
    (a) #intro (b) span (c) .red (d) .big
  4. 4.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 130px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  5. 5.🌈 In #000027 the blue part is the hex number 27. What is it as a normal number?
  6. 6.What does justify-content: center do? (a) equal gaps, none at ends (b) puts boxes in the middle (c) packs boxes at the end (d) packs boxes at the start
  7. 7.🌈 Which colour is rgb(255, 0, 255)? (a) blue (b) black (c) white (d) magenta
  8. 8.Which of these is the border? (a) a solid or dotted edge (b) space inside the border (c) the text or picture (d) the gap to other boxes
  9. 9.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      border: 2px solid;
      font-weight: bold;
      color: red;
    }
  10. 10.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 370px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  11. 11.🖌️ How big is the text, in px?
    h1 {
      color: red;
      text-align: center;
      background-color: green;
      font-size: 12px;
    }
  12. 12.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 300px;
      padding: 5px;
      border: 1px solid black;
      margin: 15px;
    }
  13. 13.⚖️ Two rules with the same selector set a colour. Which one wins? (a) neither (b) the shorter one (c) the later one (d) the first one
  14. 14.True or false: .big is an id selector. (a) False (b) True
  15. 15.🧩 Which language counts down a timer? (a) HTML (b) CSS (c) JavaScript
  16. 16.🎯 Which element does the selector .note style? (a) <div class="note"> (b) <div class="big"> (c) <div id="note"> (d) <span class="red">
  17. 17.⚖️ What colour is the text of this element?
    <p class="star" id="end">Hi</p>
    CSS:
    p { color: blue; }
    .star { color: white; }
    (a) green (b) white (c) blue (d) red
  18. 18.🌈 In #340000 the red part is the hex number 34. What is it as a normal number?
  19. 19.🌈 Which hex code is blue? (a) #00ffff (b) #0000ff (c) #ffffff (d) #000000
  20. 20.⚖️ What colour is the text of this element?
    <h2 class="note" id="logo">Hi</h2>
    CSS:
    h2 { color: orange; }
    #logo { color: blue; }
    (a) orange (b) purple (c) green (d) blue
  21. 21.✍️ In color: blue; which part is the property? (a) ; (b) color (c) blue (d) :
  22. 22.🔍 Which is the odd one out? (a) makes a form box (b) adds space around boxes (c) sets colours and fonts (d) rounds box corners
  23. 23.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 170px;
      padding: 30px;
      border: 1px solid black;
      margin: 10px;
    }
  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: 240px;
      padding: 15px;
      border: 4px solid black;
      margin: 20px;
    }
  25. 25.⚖️ What colour is the text of this element?
    <h2 class="star" id="top">Hi</h2>
    CSS:
    h2 { color: white; }
    .star { color: red; }
    #top { color: blue; }
    (a) purple (b) blue (c) red (d) white
  26. 26.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 230px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  27. 27.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 210px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  28. 28.⚖️ What colour is the text of this element?
    <h2 class="note" id="end">Hi</h2>
    CSS:
    h2 { color: yellow; }
    h2 { color: black; }
    (a) yellow (b) red (c) blue (d) black
  29. 29.🧩 Which language puts a picture on a page? (a) HTML (b) JavaScript (c) CSS
  30. 30.⚖️ What colour is the text of this element?
    <h1 class="big" id="end">Hi</h1>
    CSS:
    .big { color: red; }
    h1 { color: green; }
    (a) red (b) green (c) purple (d) white
  31. 31.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 26px;
      }
    }
  32. 32.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 210px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  33. 33.🌈 Which colour of light is strongest in rgb(91, 43, 169)? (a) red (b) green (c) blue
  34. 34.🧩 Which language makes headings and lists? (a) CSS (b) JavaScript (c) HTML
  35. 35.📱 Responsive design means a page ___. (a) never changes (b) fits every screen (c) is only for laptops (d) has no pictures
  36. 36.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 180px;
      justify-content: center;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  37. 37.💪 Which flexbox property picks row or column? (a) gap (b) flex-direction (c) align-items (d) justify-content
  38. 38.🎯 Which CSS selector matches this element?
    <h2 class="menu" id="intro">Hello</h2>
    (a) #menu (b) .menu (c) .note (d) #main
  39. 39.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 18px;
      }
    }
  40. 40.✍️ CSS declarations go inside which brackets? (a) [ ] (b) ( ) (c) { } (d) < >

Answer key

  1. text-align
  2. True
  3. .big
  4. 10
  5. 39
  6. puts boxes in the middle
  7. magenta
  8. a solid or dotted edge
  9. 3
  10. 70
  11. 12
  12. 342
  13. the later one
  14. False
  15. JavaScript
  16. <div class="note">
  17. white
  18. 52
  19. #0000ff
  20. blue
  21. color
  22. makes a form box
  23. 252
  24. 278
  25. blue
  26. 30
  27. 50
  28. black
  29. HTML
  30. red
  31. 26
  32. 10
  33. blue
  34. HTML
  35. fits every screen
  36. 40
  37. flex-direction
  38. .menu
  39. 18
  40. { }

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