← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 121 · 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 colour of light is strongest in rgb(221, 76, 105)? (a) blue (b) red (c) green
  2. 2.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 18px;
      }
    }
  3. 3.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 260px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  4. 4.💪 Which flexbox property sets space between boxes? (a) gap (b) display: flex (c) justify-content (d) align-items
  5. 5.🖌️ Where does the text sit on its line?
    p {
      font-size: 20px;
      text-align: left;
      color: purple;
      background-color: red;
    }
    (a) on the left (b) on the right (c) in the middle
  6. 6.🌈 Which colour is rgb(255, 255, 255)? (a) red (b) white (c) yellow (d) cyan
  7. 7.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 190px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  8. 8.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) the first one (c) the later one (d) neither
  9. 9.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      background-color: yellow;
      padding: 8px;
      border: 2px solid;
      margin: 10px;
    }
  10. 10.🌈 In #rrggbb, which colour do the last two digits give? (a) white (b) green (c) red (d) blue
  11. 11.🔍 Which is the odd one out? (a) makes a form box (b) shows a pop-up message (c) puts a picture on a page (d) gives the page structure
  12. 12.💪 Which flexbox property lines boxes up across? (a) justify-content (b) gap (c) flex-direction (d) align-items
  13. 13.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 180px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 50px wide (no margins).
  14. 14.What does text-align do? (a) sets the letter colour (b) makes letters bigger (c) centres a heading (d) makes the text bold
  15. 15.True or false: HTML sets colours and fonts. (a) True (b) False
  16. 16.🌈 Which colour of light is strongest in rgb(74, 234, 140)? (a) green (b) blue (c) red
  17. 17.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 280px;
      justify-content: center;
    }
    Inside are 3 boxes, each 80px wide (no margins).
  18. 18.True or false: .big is an id selector. (a) False (b) True
  19. 19.🎯 Which CSS selector matches this element?
    <span class="note" id="main">Hello</span>
    (a) .big (b) #note (c) span (d) .main
  20. 20.Which of these is the content? (a) a solid or dotted edge (b) the line round the box (c) the text or picture (d) the gap round content
  21. 21.⚖️ Which selector is the strongest? (a) an id selector (b) a class selector (c) an element selector
  22. 22.🌈 Which hex code is yellow? (a) #ff00ff (b) #00ff00 (c) #ffff00 (d) #ff0000
  23. 23.⚖️ What colour is the text of this element?
    <h2 class="star" id="logo">Hi</h2>
    CSS:
    .star { color: purple; }
    #logo { color: white; }
    h2 { color: black; }
    (a) white (b) orange (c) black (d) purple
  24. 24.📦 In the box model, which part is a solid or dotted edge? (a) margin (b) content (c) border (d) padding
  25. 25.✍️ In color: blue; which part is the property? (a) : (b) ; (c) blue (d) color
  26. 26.🌈 In #000011 the blue part is the hex number 11. What is it as a normal number?
  27. 27.🌈 In #300000 the red part is the hex number 30. What is it as a normal number?
  28. 28.🖌️ Where does the text sit on its line?
    li {
      background-color: orange;
      font-size: 16px;
      color: black;
      text-align: right;
    }
    (a) on the left (b) in the middle (c) on the right
  29. 29.📱 Responsive design means a page ___. (a) fits every screen (b) never changes (c) has no pictures (d) is only for laptops
  30. 30.✍️ In color: blue; which part is the value? (a) ; (b) color (c) : (d) blue
  31. 31.🎨 What does CSS stand for? (a) Creative Sheet System (b) Computer Style Sheets (c) Colourful Site Styles (d) Cascading Style Sheets
  32. 32.True or false: JavaScript changes the page live. (a) False (b) True
  33. 33.⚖️ What colour is the text of this element?
    <p class="note" id="intro">Hi</p>
    CSS:
    #intro { color: blue; }
    .note { color: purple; }
    p { color: white; }
    (a) white (b) green (c) purple (d) blue
  34. 34.🎯 How many elements on a page should have the same id? (a) 1 (b) any number (c) 5 (d) 2
  35. 35.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 250px;
      padding: 5px;
      border: 4px solid black;
      margin: 20px;
    }
  36. 36.🔍 Which is the odd one out? (a) sets colours and fonts (b) gives the page structure (c) makes a link (d) makes headings and lists
  37. 37.What does justify-content: flex-start do? (a) packs boxes at the end (b) equal gaps, none at ends (c) packs boxes at the start (d) puts boxes in the middle
  38. 38.🌈 Which colour is rgb(255, 255, 0)? (a) magenta (b) cyan (c) yellow (d) white
  39. 39.🔍 Which is the odd one out? (a) makes a link (b) gives the page structure (c) adds space around boxes (d) puts a picture on a page
  40. 40.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 130px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 50px wide (no margins).

Answer key

  1. red
  2. 18
  3. 60
  4. gap
  5. on the left
  6. white
  7. 10
  8. the later one
  9. 4
  10. blue
  11. shows a pop-up message
  12. align-items
  13. 30
  14. centres a heading
  15. False
  16. green
  17. 20
  18. False
  19. span
  20. the text or picture
  21. an id selector
  22. #ffff00
  23. white
  24. border
  25. color
  26. 17
  27. 48
  28. on the right
  29. fits every screen
  30. blue
  31. Cascading Style Sheets
  32. True
  33. blue
  34. 1
  35. 268
  36. sets colours and fonts
  37. packs boxes at the start
  38. yellow
  39. adds space around boxes
  40. 30

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