← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 600 · 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 hex code is black? (a) #ffffff (b) #00ff00 (c) #000000 (d) #0000ff
  2. 2.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 60px;
      padding: 30px;
      border: 1px solid black;
      margin: 20px;
    }
  3. 3.📦 In the box model, which part is space inside the border? (a) content (b) padding (c) border (d) margin
  4. 4.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 14px;
      }
    }
    (a) No (b) Yes
  5. 5.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 190px;
      justify-content: space-between;
    }
    Inside are 3 boxes, each 50px wide (no margins).
  6. 6.🖌️ What colour is behind the letters?
    h2 {
      font-size: 12px;
      background-color: green;
      text-align: right;
      color: yellow;
    }
    (a) purple (b) green (c) yellow
  7. 7.🌈 Which colour is #000000? (a) black (b) white (c) yellow (d) cyan
  8. 8.🌈 In #rrggbb, which colour do the last two digits give? (a) blue (b) green (c) red (d) white
  9. 9.🖌️ Where does the text sit on its line?
    p {
      text-align: left;
      font-size: 28px;
      background-color: white;
      color: yellow;
    }
    (a) on the left (b) on the right (c) in the middle
  10. 10.⚖️ Two rules with the same selector set a colour. Which one wins? (a) neither (b) the later one (c) the first one (d) the shorter one
  11. 11.What does font-weight do? (a) makes letters bigger (b) makes the text bold (c) picks the font style (d) centres a heading
  12. 12.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 520px;
      justify-content: center;
    }
    Inside are 4 boxes, each 100px wide (no margins).
  13. 13.📦 In the box model, which part is the line round the box? (a) content (b) margin (c) border (d) padding
  14. 14.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 18px;
      }
    }
    (a) No (b) Yes
  15. 15.What does color do? (a) picks the font style (b) centres a heading (c) makes the text bold (d) sets the letter colour
  16. 16.💪 Which justify-content value packs boxes at the start? (a) flex-start (b) center (c) flex-end (d) space-between
  17. 17.🖌️ Which CSS property picks the font style? (a) background-color (b) font-size (c) font-family (d) font-weight
  18. 18.📱 max-width: 600px applies when the screen is ___. (a) exactly 1000px (b) turned off (c) 600px or wider (d) 600px or narrower
  19. 19.⚖️ Which selector is the strongest? (a) a class selector (b) an element selector (c) an id selector
  20. 20.🎯 What kind of selector is p? (a) a class selector (b) an id selector (c) an element selector
  21. 21.✍️ What is the selector in this CSS rule?
    .note {
      padding: 8px;
      font-style: italic;
    }
    (a) #top (b) .note (c) padding (d) italic
  22. 22.✍️ In color: blue; which part is the value? (a) : (b) blue (c) color (d) ;
  23. 23.✍️ What is the selector in this CSS rule?
    body {
      background-color: yellow;
      font-style: italic;
    }
    (a) .box (b) body (c) italic (d) background-color
  24. 24.🌈 What is the biggest number one colour can have in rgb()? (a) 255 (b) 99 (c) 100 (d) 1000
  25. 25.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 90px;
      padding: 30px;
      border: 3px solid black;
      margin: 0px;
    }
  26. 26.🎯 Which CSS selector matches this element?
    <div class="note" id="end">Hello</div>
    (a) .end (b) #end (c) span (d) .big
  27. 27.Which of these is the border? (a) a solid or dotted edge (b) space outside the border (c) the gap to other boxes (d) the text or picture
  28. 28.🎯 Which CSS selector matches this element?
    <div class="box" id="end">Hello</div>
    (a) #hero (b) .star (c) div (d) span
  29. 29.🎯 Which sign starts a class selector? (a) # (b) @ (c) & (d) .
  30. 30.What does background-color do? (a) colours behind the text (b) centres a heading (c) sets the letter colour (d) makes the text bold
  31. 31.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      background-color: yellow;
      color: red;
    }
  32. 32.🎯 Which element does the selector #main style? (a) <div class="main"> (b) <span class="note"> (c) <div id="main"> (d) <div id="logo">
  33. 33.✍️ Which property is set to red in this rule?
    h1 {
      font-weight: bold;
      background-color: yellow;
      color: red;
      padding: 8px;
    }
    (a) font-size (b) text-align (c) color (d) red
  34. 34.🔍 Which is the odd one out? (a) sets colours and fonts (b) gives the page structure (c) changes the text size (d) adds space around boxes
  35. 35.🖌️ What colour is behind the letters?
    p {
      text-align: right;
      font-size: 12px;
      color: green;
      background-color: black;
    }
    (a) green (b) red (c) black
  36. 36.🖌️ Which CSS property makes the text bold? (a) font-weight (b) font-size (c) font-family (d) background-color
  37. 37.True or false: JavaScript makes a form box. (a) True (b) False
  38. 38.🎯 Which CSS selector matches this element?
    <span class="note" id="main">Hello</span>
    (a) .main (b) #main (c) .big (d) #note
  39. 39.🖌️ What colour are the letters?
    h1 {
      font-size: 36px;
      background-color: yellow;
      text-align: center;
      color: blue;
    }
    (a) purple (b) yellow (c) blue
  40. 40.Which of these does JavaScript do? (a) makes a link (b) makes a form box (c) reacts to a button click (d) rounds box corners

Answer key

  1. #000000
  2. 162
  3. padding
  4. Yes
  5. 20
  6. green
  7. black
  8. blue
  9. on the left
  10. the later one
  11. makes the text bold
  12. 60
  13. border
  14. Yes
  15. sets the letter colour
  16. flex-start
  17. font-family
  18. 600px or narrower
  19. an id selector
  20. an element selector
  21. .note
  22. blue
  23. body
  24. 255
  25. 156
  26. #end
  27. a solid or dotted edge
  28. div
  29. .
  30. colours behind the text
  31. 2
  32. <div id="main">
  33. color
  34. gives the page structure
  35. black
  36. font-weight
  37. False
  38. #main
  39. blue
  40. reacts to a button click

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