← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 927 · 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.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 2 (b) 4 (c) 6 (d) 3
  2. 2.Which of these does JavaScript do? (a) makes a form box (b) adds space around boxes (c) checks a quiz answer (d) changes the text size
  3. 3.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 18px;
      }
    }
    (a) No (b) Yes
  4. 4.🎨 Which tag connects an outside CSS file? (a) <css> (b) <img> (c) <link> (d) <a>
  5. 5.🖌️ Where does the text sit on its line?
    h2 {
      background-color: black;
      text-align: right;
      font-size: 20px;
      color: orange;
    }
    (a) in the middle (b) on the right (c) on the left
  6. 6.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 90px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  7. 7.✍️ How many declarations (property: value pairs) are in this rule?
    body {
      font-weight: bold;
      width: 300px;
      padding: 8px;
    }
  8. 8.🎯 Which element does the selector #intro style? (a) <div class="intro"> (b) <div id="main"> (c) <span class="big"> (d) <div id="intro">
  9. 9.True or false: JavaScript rounds box corners. (a) True (b) False
  10. 10.🖌️ Where does the text sit on its line?
    p {
      background-color: yellow;
      text-align: center;
      font-size: 24px;
      color: green;
    }
    (a) on the left (b) on the right (c) in the middle
  11. 11.⚖️ What colour is the text of this element?
    <p class="big" id="main">Hi</p>
    CSS:
    #main { color: orange; }
    #main { color: blue; }
    (a) green (b) red (c) blue (d) orange
  12. 12.✍️ What value is given to text-align in this rule?
    h2 {
      background-color: yellow;
      color: red;
      text-align: center;
      padding: 8px;
    }
    (a) yellow (b) 10px (c) text-align (d) center
  13. 13.🖌️ Where does the text sit on its line?
    h1 {
      background-color: orange;
      font-size: 32px;
      color: yellow;
      text-align: right;
    }
    (a) on the left (b) on the right (c) in the middle
  14. 14.💪 Which flexbox property sets space between boxes? (a) gap (b) align-items (c) display: flex (d) justify-content
  15. 15.What does font-weight do? (a) centres a heading (b) sets the letter colour (c) makes letters bigger (d) makes the text bold
  16. 16.🌈 In #000091 the blue part is the hex number 91. What is it as a normal number?
  17. 17.✍️ What value is given to background-color in this rule?
    body {
      padding: 8px;
      text-align: center;
      border: 2px solid;
      background-color: yellow;
    }
    (a) 8px (b) background-color (c) 10px (d) yellow
  18. 18.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 170px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  19. 19.🌈 Which colour of light is strongest in rgb(108, 156, 137)? (a) green (b) red (c) blue
  20. 20.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 50px;
      padding: 10px;
      border: 4px solid black;
      margin: 15px;
    }
  21. 21.✍️ What is the selector in this CSS rule?
    h2 {
      color: red;
      text-align: center;
      margin: 10px;
    }
    (a) h2 (b) center (c) color (d) h1
  22. 22.🧩 Which language adds space around boxes? (a) HTML (b) JavaScript (c) CSS
  23. 23.📱 The screen is 1366px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 18px;
      }
    }
    (a) No (b) Yes
  24. 24.✍️ What is the selector in this CSS rule?
    p {
      background-color: yellow;
      font-weight: bold;
    }
    (a) p (b) bold (c) .note (d) background-color
  25. 25.✍️ Which property is set to 8px in this rule?
    h2 {
      margin: 10px;
      background-color: yellow;
      padding: 8px;
    }
    (a) padding (b) 8px (c) border (d) font-weight
  26. 26.⚖️ What colour is the text of this element?
    <h1 class="star" id="main">Hi</h1>
    CSS:
    h1 { color: white; }
    #main { color: yellow; }
    .star { color: green; }
    (a) yellow (b) white (c) blue (d) green
  27. 27.✍️ Which property is set to 300px in this rule?
    p {
      color: red;
      font-size: 20px;
      width: 300px;
    }
    (a) 300px (b) font-style (c) width (d) color
  28. 28.What does justify-content: flex-start do? (a) packs boxes at the start (b) puts boxes in the middle (c) equal gaps, none at ends (d) packs boxes at the end
  29. 29.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 16px;
      }
    }
  30. 30.🌈 Which colour is rgb(0, 255, 0)? (a) red (b) cyan (c) bright green (d) yellow
  31. 31.⚖️ What colour is the text of this element?
    <p class="note" id="main">Hi</p>
    CSS:
    .note { color: black; }
    #main { color: yellow; }
    (a) red (b) yellow (c) orange (d) black
  32. 32.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the later one (b) the shorter one (c) the first one (d) neither
  33. 33.🎯 Which CSS selector matches this element?
    <h2 class="big" id="top">Hello</h2>
    (a) li (b) #big (c) .big (d) #intro
  34. 34.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 14px;
      }
    }
  35. 35.✍️ CSS declarations go inside which brackets? (a) < > (b) ( ) (c) [ ] (d) { }
  36. 36.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 22px;
      }
    }
  37. 37.🎯 Which element does the selector h1 style? (a) <li class="menu"> (b) <h1 class="menu"> (c) <div id="end"> (d) <h2>
  38. 38.✍️ Which sign goes between a property and its value? (a) - (b) ; (c) = (d) :
  39. 39.⚖️ What colour is the text of this element?
    <h1 class="note" id="top">Hi</h1>
    CSS:
    #top { color: purple; }
    #top { color: black; }
    (a) red (b) blue (c) purple (d) black
  40. 40.💪 Which flexbox property turns on flexbox? (a) display: flex (b) align-items (c) gap (d) justify-content

Answer key

  1. 3
  2. checks a quiz answer
  3. Yes
  4. <link>
  5. on the right
  6. 10
  7. 3
  8. <div id="intro">
  9. False
  10. in the middle
  11. blue
  12. center
  13. on the right
  14. gap
  15. makes the text bold
  16. 145
  17. yellow
  18. 50
  19. green
  20. 108
  21. h2
  22. CSS
  23. Yes
  24. p
  25. padding
  26. yellow
  27. width
  28. packs boxes at the start
  29. 16
  30. bright green
  31. yellow
  32. the later one
  33. .big
  34. 20
  35. { }
  36. 24
  37. <h1 class="menu">
  38. :
  39. black
  40. display: flex

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