← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 303 · 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 colour is the text of this element?
    <p class="big" id="main">Hi</p>
    CSS:
    #main { color: orange; }
    #main { color: purple; }
    (a) purple (b) red (c) orange (d) black
  2. 2.🎯 Which sign starts an id selector? (a) @ (b) . (c) # (d) &
  3. 3.🌈 Which colour is #ffffff? (a) cyan (b) magenta (c) white (d) bright green
  4. 4.Which of these does HTML do? (a) makes headings and lists (b) shows a pop-up message (c) counts down a timer (d) changes the text size
  5. 5.Which of these does HTML do? (a) checks a quiz answer (b) changes the text size (c) sets colours and fonts (d) makes a link
  6. 6.✍️ What is the selector in this CSS rule?
    p {
      background-color: yellow;
      font-size: 20px;
      font-weight: bold;
      text-align: center;
    }
    (a) p (b) 20px (c) .note (d) background-color
  7. 7.🔍 Which is the odd one out? (a) rounds box corners (b) counts down a timer (c) lays out the page (d) adds space around boxes
  8. 8.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 110px;
      padding: 5px;
      border: 2px solid black;
      margin: 15px;
    }
  9. 9.🖌️ How big is the text, in px?
    li {
      background-color: yellow;
      text-align: left;
      color: red;
      font-size: 24px;
    }
  10. 10.True or false: HTML makes a form box. (a) False (b) True
  11. 11.⚖️ What colour is the text of this element?
    <p class="red" id="main">Hi</p>
    CSS:
    .red { color: red; }
    .red { color: green; }
    (a) blue (b) black (c) green (d) red
  12. 12.🎨 Which tag connects an outside CSS file? (a) <link> (b) <img> (c) <a> (d) <css>
  13. 13.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 150px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  14. 14.📱 min-width: 800px applies when the screen is ___. (a) exactly 100px (b) 800px or narrower (c) 800px or wider (d) turned off
  15. 15.🌈 Which colour is rgb(255, 0, 0)? (a) bright green (b) magenta (c) red (d) black
  16. 16.✍️ What is the selector in this CSS rule?
    #top {
      margin: 10px;
      background-color: yellow;
      font-style: italic;
      padding: 8px;
    }
    (a) yellow (b) margin (c) #top (d) li
  17. 17.True or false: CSS makes a link. (a) True (b) False
  18. 18.💪 Which justify-content value puts boxes in the middle? (a) flex-start (b) space-between (c) center (d) flex-end
  19. 19.⚖️ 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
  20. 20.🎯 What kind of selector is .star? (a) an element selector (b) an id selector (c) a class selector
  21. 21.⚖️ Which selector is the weakest? (a) an id selector (b) an element selector (c) a class selector
  22. 22.✍️ Which property is set to 300px in this rule?
    p {
      width: 300px;
      color: red;
      margin: 10px;
      padding: 8px;
    }
    (a) width (b) color (c) font-style (d) 300px
  23. 23.Which of these does HTML do? (a) changes the text size (b) checks a quiz answer (c) puts a picture on a page (d) shows a pop-up message
  24. 24.🖌️ What colour is behind the letters?
    p {
      background-color: red;
      color: orange;
      text-align: left;
      font-size: 24px;
    }
    (a) red (b) orange (c) blue
  25. 25.🎯 What kind of selector is #hero? (a) an id selector (b) an element selector (c) a class selector
  26. 26.🌈 Hex digits go 0 to 9, then A to which letter? (a) J (b) F (c) G (d) Z
  27. 27.⚖️ What colour is the text of this element?
    <h2 class="star" id="logo">Hi</h2>
    CSS:
    #logo { color: green; }
    #logo { color: white; }
    (a) green (b) yellow (c) red (d) white
  28. 28.📱 Responsive design means a page ___. (a) fits every screen (b) has no pictures (c) never changes (d) is only for laptops
  29. 29.📦 In the box model, which part is the text or picture? (a) border (b) content (c) padding (d) margin
  30. 30.⚖️ What colour is the text of this element?
    <h1 class="red" id="intro">Hi</h1>
    CSS:
    h1 { color: red; }
    h1 { color: purple; }
    (a) blue (b) purple (c) red (d) orange
  31. 31.🖌️ How big is the text, in px?
    h2 {
      color: green;
      text-align: center;
      font-size: 36px;
      background-color: blue;
    }
  32. 32.🔍 Which is the odd one out? (a) changes the text size (b) gives the page structure (c) puts a picture on a page (d) makes headings and lists
  33. 33.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 200px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 60px wide (no margins).
  34. 34.✍️ What value is given to color in this rule?
    body {
      background-color: yellow;
      color: red;
      font-style: italic;
    }
    (a) 20px (b) center (c) red (d) color
  35. 35.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 240px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  36. 36.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 2 (b) 3 (c) 4 (d) 6
  37. 37.📱 What does a media query check? (a) the battery level (b) the screen width (c) the page title (d) the time of day
  38. 38.✍️ What value is given to font-size in this rule?
    h2 {
      color: red;
      font-size: 20px;
      width: 300px;
    }
    (a) font-size (b) yellow (c) center (d) 20px
  39. 39.🎯 What kind of selector is p? (a) a class selector (b) an id selector (c) an element selector
  40. 40.🌈 In #rrggbb, which colour do the last two digits give? (a) blue (b) green (c) white (d) red

Answer key

  1. purple
  2. #
  3. white
  4. makes headings and lists
  5. makes a link
  6. p
  7. counts down a timer
  8. 124
  9. 24
  10. True
  11. green
  12. <link>
  13. 30
  14. 800px or wider
  15. red
  16. #top
  17. False
  18. center
  19. the later one
  20. a class selector
  21. an element selector
  22. width
  23. puts a picture on a page
  24. red
  25. an id selector
  26. F
  27. white
  28. fits every screen
  29. content
  30. purple
  31. 36
  32. changes the text size
  33. 20
  34. red
  35. 40
  36. 3
  37. the screen width
  38. 20px
  39. an element selector
  40. blue

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