← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 965 · 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.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 6px;
      }
    }
    (a) Yes (b) No
  2. 2.🌈 Which colour is #00ff00? (a) bright green (b) red (c) black (d) magenta
  3. 3.✍️ What is the selector in this CSS rule?
    #top {
      color: red;
      text-align: center;
      border: 2px solid;
    }
    (a) center (b) color (c) li (d) #top
  4. 4.🖌️ Which CSS property picks the font style? (a) font-family (b) text-align (c) color (d) background-color
  5. 5.True or false: #hero is an id selector. (a) False (b) True
  6. 6.🎨 Which tag connects an outside CSS file? (a) <img> (b) <css> (c) <a> (d) <link>
  7. 7.Which of these is padding? (a) the gap round content (b) the line round the box (c) the gap to other boxes (d) space outside the border
  8. 8.🎯 What kind of selector is .card? (a) an id selector (b) a class selector (c) an element selector
  9. 9.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 250px;
      padding: 25px;
      border: 1px solid black;
      margin: 0px;
    }
  10. 10.🌈 In #00bb00 the green part is the hex number bb. What is it as a normal number?
  11. 11.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 32px;
      }
    }
    (a) No (b) Yes
  12. 12.🌈 In #820000 the red part is the hex number 82. What is it as a normal number?
  13. 13.⚖️ What colour is the text of this element?
    <p class="box" id="top">Hi</p>
    CSS:
    .box { color: black; }
    #top { color: red; }
    (a) black (b) blue (c) yellow (d) red
  14. 14.Which of these does HTML do? (a) rounds box corners (b) lays out the page (c) adds space around boxes (d) makes a form box
  15. 15.🌈 In #rrggbb, which colour do the last two digits give? (a) red (b) white (c) green (d) blue
  16. 16.🖌️ Which CSS property sets the letter colour? (a) font-size (b) font-weight (c) text-align (d) color
  17. 17.🎯 How many elements on a page should have the same id? (a) 1 (b) any number (c) 2 (d) 5
  18. 18.✍️ What is the selector in this CSS rule?
    h2 {
      text-align: center;
      font-weight: bold;
      width: 300px;
      font-style: italic;
    }
    (a) bold (b) text-align (c) h1 (d) h2
  19. 19.✍️ How many declarations (property: value pairs) are in this rule?
    .box {
      text-align: center;
      font-size: 20px;
      padding: 8px;
    }
  20. 20.🌈 Which colour is rgb(0, 255, 255)? (a) magenta (b) bright green (c) cyan (d) red
  21. 21.🔍 Which is the odd one out? (a) makes headings and lists (b) makes a form box (c) changes the page live (d) puts a picture on a page
  22. 22.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 2 (b) 4 (c) 3 (d) 6
  23. 23.🎯 Which sign starts a class selector? (a) # (b) . (c) & (d) @
  24. 24.⚖️ What colour is the text of this element?
    <h1 class="note" id="main">Hi</h1>
    CSS:
    h1 { color: blue; }
    h1 { color: orange; }
    (a) orange (b) white (c) purple (d) blue
  25. 25.✍️ How many declarations (property: value pairs) are in this rule?
    .box {
      font-style: italic;
      background-color: yellow;
      padding: 8px;
      color: red;
    }
  26. 26.🌈 What is the biggest number one colour can have in rgb()? (a) 99 (b) 100 (c) 1000 (d) 255
  27. 27.⚖️ Two rules with the same selector set a colour. Which one wins? (a) neither (b) the first one (c) the shorter one (d) the later one
  28. 28.📱 min-width: 800px applies when the screen is ___. (a) 800px or wider (b) exactly 100px (c) turned off (d) 800px or narrower
  29. 29.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 80px;
      padding: 5px;
      border: 3px solid black;
      margin: 15px;
    }
  30. 30.🌈 Which colour is #00ffff? (a) cyan (b) magenta (c) bright green (d) white
  31. 31.🌈 Which colour is #ffff00? (a) bright green (b) black (c) yellow (d) cyan
  32. 32.⚖️ What colour is the text of this element?
    <p class="big" id="logo">Hi</p>
    CSS:
    p { color: black; }
    p { color: orange; }
    (a) purple (b) orange (c) black (d) blue
  33. 33.✍️ What is the selector in this CSS rule?
    #top {
      border: 2px solid;
      margin: 10px;
      color: red;
    }
    (a) li (b) border (c) #top (d) 10px
  34. 34.Which of these is margin? (a) a solid or dotted edge (b) space inside the border (c) space outside the border (d) the text or picture
  35. 35.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 18px;
      }
    }
  36. 36.True or false: JavaScript lays out the page. (a) True (b) False
  37. 37.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 220px;
      justify-content: center;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  38. 38.🎯 What kind of selector is #main? (a) an element selector (b) a class selector (c) an id selector
  39. 39.🌈 Which colour is rgb(0, 255, 0)? (a) white (b) magenta (c) blue (d) bright green
  40. 40.🎯 Which element does the selector #logo style? (a) <span id="logo"> (b) <p class="menu"> (c) <span class="logo"> (d) <span id="end">

Answer key

  1. Yes
  2. bright green
  3. #top
  4. font-family
  5. True
  6. <link>
  7. the gap round content
  8. a class selector
  9. 302
  10. 187
  11. No
  12. 130
  13. red
  14. makes a form box
  15. blue
  16. color
  17. 1
  18. h2
  19. 3
  20. cyan
  21. changes the page live
  22. 3
  23. .
  24. orange
  25. 4
  26. 255
  27. the later one
  28. 800px or wider
  29. 126
  30. cyan
  31. yellow
  32. orange
  33. #top
  34. space outside the border
  35. 18
  36. False
  37. 50
  38. an id selector
  39. bright green
  40. <span id="logo">

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