← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 403 · 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.🖌️ Where does the text sit on its line?
    li {
      font-size: 28px;
      text-align: right;
      background-color: blue;
      color: black;
    }
    (a) on the right (b) in the middle (c) on the left
  2. 2.🖌️ What colour is behind the letters?
    h2 {
      background-color: orange;
      font-size: 32px;
      color: white;
      text-align: left;
    }
    (a) red (b) orange (c) white
  3. 3.🎯 Which element does the selector p style? (a) <p class="big"> (b) <li id="main"> (c) <h2 class="big"> (d) <h1>
  4. 4.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 70px;
      padding: 20px;
      border: 5px solid black;
      margin: 10px;
    }
  5. 5.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 18px;
      }
    }
    (a) Yes (b) No
  6. 6.⚖️ What colour is the text of this element?
    <p class="big" id="top">Hi</p>
    CSS:
    #top { color: yellow; }
    #top { color: red; }
    (a) white (b) yellow (c) red (d) blue
  7. 7.True or false: JavaScript changes the page live. (a) False (b) True
  8. 8.⚖️ Which selector is the weakest? (a) an id selector (b) an element selector (c) a class selector
  9. 9.🎯 How many elements on a page should have the same id? (a) 1 (b) 5 (c) 2 (d) any number
  10. 10.✍️ Which sign goes between a property and its value? (a) - (b) ; (c) = (d) :
  11. 11.🎯 What kind of selector is #hero? (a) a class selector (b) an element selector (c) an id selector
  12. 12.🌈 In #004100 the green part is the hex number 41. What is it as a normal number?
  13. 13.🖌️ Which CSS property makes letters bigger? (a) font-size (b) font-weight (c) color (d) background-color
  14. 14.✍️ Which property is set to yellow in this rule?
    body {
      margin: 10px;
      background-color: yellow;
    }
    (a) padding (b) margin (c) yellow (d) background-color
  15. 15.True or false: HTML lays out the page. (a) True (b) False
  16. 16.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 230px;
      padding: 5px;
      border: 5px solid black;
      margin: 5px;
    }
  17. 17.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 220px;
      padding: 10px;
      border: 2px solid black;
      margin: 20px;
    }
  18. 18.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 270px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  19. 19.⚖️ Which selector is the strongest? (a) a class selector (b) an element selector (c) an id selector
  20. 20.⚖️ What colour is the text of this element?
    <p class="big" id="end">Hi</p>
    CSS:
    p { color: yellow; }
    .big { color: blue; }
    (a) purple (b) yellow (c) blue (d) red
  21. 21.🎯 What kind of selector is #main? (a) an id selector (b) a class selector (c) an element selector
  22. 22.🌈 In #rrggbb, which colour do the first two digits give? (a) red (b) blue (c) green (d) black
  23. 23.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 18px;
      }
    }
  24. 24.✍️ How many declarations (property: value pairs) are in this rule?
    .box {
      font-weight: bold;
      background-color: yellow;
    }
  25. 25.🌈 Which colour of light is strongest in rgb(152, 37, 13)? (a) green (b) red (c) blue
  26. 26.📱 min-width: 800px applies when the screen is ___. (a) exactly 100px (b) turned off (c) 800px or narrower (d) 800px or wider
  27. 27.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 26px;
      }
    }
    (a) No (b) Yes
  28. 28.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 110px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  29. 29.True or false: CSS reacts to a button click. (a) True (b) False
  30. 30.🎯 Which CSS selector matches this element?
    <h1 class="note" id="logo">Hello</h1>
    (a) h2 (b) h1 (c) #end (d) #note
  31. 31.🖌️ Which CSS property picks the font style? (a) color (b) font-family (c) text-align (d) background-color
  32. 32.What does background-color do? (a) makes the text bold (b) colours behind the text (c) sets the letter colour (d) picks the font style
  33. 33.True or false: CSS adds space around boxes. (a) False (b) True
  34. 34.📱 What does a media query check? (a) the time of day (b) the battery level (c) the page title (d) the screen width
  35. 35.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 220px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  36. 36.True or false: .menu is an id selector. (a) True (b) False
  37. 37.⚖️ What colour is the text of this element?
    <h2 class="note" id="top">Hi</h2>
    CSS:
    .note { color: purple; }
    .note { color: blue; }
    (a) black (b) purple (c) orange (d) blue
  38. 38.🌈 In #00dc00 the green part is the hex number dc. What is it as a normal number?
  39. 39.✍️ What value is given to font-weight in this rule?
    h1 {
      border: 2px solid;
      font-weight: bold;
      font-style: italic;
    }
    (a) bold (b) font-weight (c) 300px (d) 2px solid
  40. 40.🌈 Which colour is rgb(255, 255, 255)? (a) magenta (b) bright green (c) cyan (d) white

Answer key

  1. on the right
  2. orange
  3. <p class="big">
  4. 140
  5. No
  6. red
  7. True
  8. an element selector
  9. 1
  10. :
  11. an id selector
  12. 65
  13. font-size
  14. background-color
  15. False
  16. 260
  17. 284
  18. 70
  19. an id selector
  20. blue
  21. an id selector
  22. red
  23. 24
  24. 2
  25. red
  26. 800px or wider
  27. Yes
  28. 10
  29. False
  30. h1
  31. font-family
  32. colours behind the text
  33. True
  34. the screen width
  35. 20
  36. False
  37. blue
  38. 220
  39. bold
  40. white

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