← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 908 · 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 does font-weight do? (a) centres a heading (b) makes the text bold (c) makes letters bigger (d) sets the letter colour
  2. 2.✍️ What value is given to text-align in this rule?
    h1 {
      text-align: center;
      color: red;
    }
    (a) text-align (b) center (c) 10px (d) yellow
  3. 3.⚖️ What colour is the text of this element?
    <h2 class="red" id="top">Hi</h2>
    CSS:
    #top { color: yellow; }
    h2 { color: blue; }
    (a) blue (b) yellow (c) black (d) red
  4. 4.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 16px;
      }
    }
    (a) Yes (b) No
  5. 5.✍️ How many declarations (property: value pairs) are in this rule?
    body {
      background-color: yellow;
      font-style: italic;
      text-align: center;
    }
  6. 6.🖌️ Where does the text sit on its line?
    h2 {
      color: orange;
      background-color: green;
      text-align: right;
      font-size: 20px;
    }
    (a) on the left (b) in the middle (c) on the right
  7. 7.📦 In the box model, which part is the text or picture? (a) margin (b) border (c) padding (d) content
  8. 8.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 230px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  9. 9.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 280px;
      padding: 25px;
      border: 5px solid black;
      margin: 15px;
    }
  10. 10.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 140px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  11. 11.🧩 Which language reacts to a button click? (a) CSS (b) JavaScript (c) HTML
  12. 12.🌈 In #rrggbb, which colour do the first two digits give? (a) blue (b) red (c) green (d) black
  13. 13.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 40px;
      padding: 10px;
      border: 5px solid black;
      margin: 15px;
    }
  14. 14.🎨 Which tag holds CSS inside the head? (a) <css> (b) <script> (c) <style> (d) <body>
  15. 15.⚖️ Which selector is the weakest? (a) an element selector (b) a class selector (c) an id selector
  16. 16.✍️ Which sign goes between a property and its value? (a) = (b) : (c) - (d) ;
  17. 17.📦 In the box model, which part is the gap round content? (a) content (b) padding (c) margin (d) border
  18. 18.🖌️ What colour are the letters?
    p {
      color: yellow;
      text-align: left;
      background-color: blue;
      font-size: 32px;
    }
    (a) blue (b) yellow (c) green
  19. 19.✍️ In color: blue; which part is the value? (a) blue (b) ; (c) color (d) :
  20. 20.Which of these is padding? (a) space inside the border (b) the gap to other boxes (c) the text or picture (d) space outside the border
  21. 21.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 20px;
      }
    }
    (a) No (b) Yes
  22. 22.Which of these does JavaScript do? (a) reacts to a button click (b) changes the text size (c) gives the page structure (d) sets colours and fonts
  23. 23.📱 max-width: 600px applies when the screen is ___. (a) turned off (b) 600px or wider (c) 600px or narrower (d) exactly 1000px
  24. 24.📦 In the box model, which part is the gap to other boxes? (a) content (b) margin (c) border (d) padding
  25. 25.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 410px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 100px wide (no margins).
  26. 26.⚖️ What colour is the text of this element?
    <p class="star" id="top">Hi</p>
    CSS:
    #top { color: green; }
    #top { color: white; }
    (a) yellow (b) green (c) orange (d) white
  27. 27.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 80px;
      padding: 30px;
      border: 3px solid black;
      margin: 10px;
    }
  28. 28.True or false: .star is a class selector. (a) False (b) True
  29. 29.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 440px;
      justify-content: space-between;
    }
    Inside are 3 boxes, each 100px wide (no margins).
  30. 30.🖌️ What colour are the letters?
    h2 {
      color: black;
      text-align: right;
      font-size: 12px;
      background-color: white;
    }
    (a) orange (b) black (c) white
  31. 31.Which of these does HTML do? (a) changes the page live (b) rounds box corners (c) sets colours and fonts (d) puts a picture on a page
  32. 32.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 220px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  33. 33.🌈 Which colour of light is strongest in rgb(199, 0, 64)? (a) red (b) green (c) blue
  34. 34.💪 Which justify-content value packs boxes at the start? (a) space-between (b) center (c) flex-end (d) flex-start
  35. 35.🎯 Which sign starts an id selector? (a) . (b) & (c) @ (d) #
  36. 36.🌈 Which hex code is magenta? (a) #ff00ff (b) #000000 (c) #ffff00 (d) #00ff00
  37. 37.✍️ How many declarations (property: value pairs) are in this rule?
    #top {
      padding: 8px;
    }
  38. 38.📱 Which tag helps phones show a page at the right size? (a) the hr tag (b) the br tag (c) the title tag (d) the viewport meta tag
  39. 39.✍️ What is the selector in this CSS rule?
    .note {
      color: red;
      margin: 10px;
      padding: 8px;
      text-align: center;
    }
    (a) color (b) #top (c) .note (d) 10px
  40. 40.⚖️ What colour is the text of this element?
    <h1 class="menu" id="top">Hi</h1>
    CSS:
    h1 { color: blue; }
    h1 { color: yellow; }
    (a) yellow (b) red (c) green (d) blue

Answer key

  1. makes the text bold
  2. center
  3. yellow
  4. Yes
  5. 3
  6. on the right
  7. content
  8. 70
  9. 370
  10. 20
  11. JavaScript
  12. red
  13. 100
  14. <style>
  15. an element selector
  16. :
  17. padding
  18. yellow
  19. blue
  20. space inside the border
  21. No
  22. reacts to a button click
  23. 600px or narrower
  24. margin
  25. 10
  26. white
  27. 166
  28. True
  29. 70
  30. black
  31. puts a picture on a page
  32. 20
  33. red
  34. flex-start
  35. #
  36. #ff00ff
  37. 1
  38. the viewport meta tag
  39. .note
  40. yellow

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