← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 946 · 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 hex code is cyan? (a) #ffffff (b) #00ffff (c) #ffff00 (d) #ff00ff
  2. 2.✍️ CSS declarations go inside which brackets? (a) ( ) (b) [ ] (c) { } (d) < >
  3. 3.🌈 Hex digits go 0 to 9, then A to which letter? (a) J (b) G (c) F (d) Z
  4. 4.Which of these does CSS do? (a) shows a pop-up message (b) counts down a timer (c) gives the page structure (d) rounds box corners
  5. 5.🎯 Which CSS selector matches this element?
    <li class="note" id="main">Hello</li>
    (a) .big (b) .note (c) .main (d) #note
  6. 6.🌈 Which hex code is black? (a) #00ff00 (b) #ffffff (c) #ffff00 (d) #000000
  7. 7.🌈 Which hex code is bright green? (a) #00ff00 (b) #0000ff (c) #ff0000 (d) #000000
  8. 8.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 24px;
      }
    }
  9. 9.🌈 In #006200 the green part is the hex number 62. What is it as a normal number?
  10. 10.🖌️ How big is the text, in px?
    h2 {
      font-size: 24px;
      background-color: red;
      text-align: right;
      color: blue;
    }
  11. 11.True or false: .note is a class selector. (a) False (b) True
  12. 12.What does background-color do? (a) makes letters bigger (b) centres a heading (c) sets the letter colour (d) colours behind the text
  13. 13.📱 min-width: 800px applies when the screen is ___. (a) exactly 100px (b) 800px or narrower (c) turned off (d) 800px or wider
  14. 14.📦 In the box model, which part is space inside the border? (a) content (b) margin (c) border (d) padding
  15. 15.✍️ What value is given to font-size in this rule?
    h1 {
      font-size: 20px;
      color: red;
    }
    (a) center (b) yellow (c) 20px (d) font-size
  16. 16.🧩 Which language changes the page live? (a) CSS (b) HTML (c) JavaScript
  17. 17.⚖️ What colour is the text of this element?
    <p class="red" id="logo">Hi</p>
    CSS:
    p { color: blue; }
    p { color: red; }
    (a) red (b) green (c) white (d) blue
  18. 18.Which of these does CSS do? (a) counts down a timer (b) makes a form box (c) changes the text size (d) makes headings and lists
  19. 19.🎯 Which sign starts a class selector? (a) @ (b) & (c) . (d) #
  20. 20.🔍 Which is the odd one out? (a) sets colours and fonts (b) changes the text size (c) makes headings and lists (d) rounds box corners
  21. 21.✍️ Which property is set to 300px in this rule?
    p {
      width: 300px;
      color: red;
    }
    (a) font-style (b) 300px (c) width (d) color
  22. 22.🖌️ What colour are the letters?
    li {
      text-align: right;
      font-size: 16px;
      color: yellow;
      background-color: blue;
    }
    (a) yellow (b) blue (c) green
  23. 23.📱 What does a media query check? (a) the battery level (b) the page title (c) the time of day (d) the screen width
  24. 24.📦 In the box model, which part is the line round the box? (a) border (b) padding (c) margin (d) content
  25. 25.💪 Which flexbox property turns on flexbox? (a) align-items (b) display: flex (c) gap (d) justify-content
  26. 26.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 28px;
      }
    }
    (a) No (b) Yes
  27. 27.⚖️ What colour is the text of this element?
    <p class="box" id="main">Hi</p>
    CSS:
    .box { color: orange; }
    p { color: white; }
    #main { color: purple; }
    (a) white (b) black (c) orange (d) purple
  28. 28.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 18px;
      }
    }
  29. 29.🖌️ Which CSS property makes the text bold? (a) font-weight (b) text-align (c) font-size (d) font-family
  30. 30.What does text-align do? (a) centres a heading (b) makes the text bold (c) makes letters bigger (d) sets the letter colour
  31. 31.✍️ What value is given to background-color in this rule?
    p {
      font-size: 20px;
      text-align: center;
      font-weight: bold;
      background-color: yellow;
    }
    (a) 10px (b) background-color (c) 8px (d) yellow
  32. 32.🎯 What kind of selector is .menu? (a) an element selector (b) an id selector (c) a class selector
  33. 33.🌈 In #008200 the green part is the hex number 82. What is it as a normal number?
  34. 34.🌈 In #006d00 the green part is the hex number 6d. What is it as a normal number?
  35. 35.✍️ Which property is set to 20px in this rule?
    li {
      font-size: 20px;
      padding: 8px;
    }
    (a) background-color (b) text-align (c) 20px (d) font-size
  36. 36.🌈 Which colour of light is strongest in rgb(111, 18, 152)? (a) blue (b) red (c) green
  37. 37.🌈 In #1f0000 the red part is the hex number 1f. What is it as a normal number?
  38. 38.🎨 Which tag connects an outside CSS file? (a) <link> (b) <css> (c) <img> (d) <a>
  39. 39.✍️ Which property is set to yellow in this rule?
    p {
      font-style: italic;
      background-color: yellow;
      margin: 10px;
    }
    (a) yellow (b) padding (c) background-color (d) margin
  40. 40.🖌️ How big is the text, in px?
    p {
      background-color: black;
      text-align: left;
      font-size: 24px;
      color: green;
    }

Answer key

  1. #00ffff
  2. { }
  3. F
  4. rounds box corners
  5. .note
  6. #000000
  7. #00ff00
  8. 24
  9. 98
  10. 24
  11. True
  12. colours behind the text
  13. 800px or wider
  14. padding
  15. 20px
  16. JavaScript
  17. red
  18. changes the text size
  19. .
  20. makes headings and lists
  21. width
  22. yellow
  23. the screen width
  24. border
  25. display: flex
  26. No
  27. purple
  28. 20
  29. font-weight
  30. centres a heading
  31. yellow
  32. a class selector
  33. 130
  34. 109
  35. font-size
  36. blue
  37. 31
  38. <link>
  39. background-color
  40. 24

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