← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 247 · 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.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 10px;
      }
    }
  2. 2.⚖️ What colour is the text of this element?
    <p class="note" id="end">Hi</p>
    CSS:
    .note { color: black; }
    .note { color: purple; }
    (a) black (b) blue (c) red (d) purple
  3. 3.True or false: margin is space inside the border. (a) False (b) True
  4. 4.💪 Which justify-content value packs boxes at the start? (a) flex-start (b) flex-end (c) space-between (d) center
  5. 5.🎯 Which element does the selector #main style? (a) <h2 class="main"> (b) <li class="big"> (c) <h2 id="main"> (d) <h2 id="logo">
  6. 6.🖌️ What colour are the letters?
    li {
      text-align: center;
      font-size: 16px;
      background-color: white;
      color: red;
    }
    (a) orange (b) white (c) red
  7. 7.✍️ What value is given to font-size in this rule?
    li {
      width: 300px;
      text-align: center;
      font-size: 20px;
    }
    (a) font-size (b) center (c) yellow (d) 20px
  8. 8.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 10px;
      }
    }
  9. 9.✍️ CSS declarations go inside which brackets? (a) { } (b) [ ] (c) < > (d) ( )
  10. 10.🌈 What is the biggest number one colour can have in rgb()? (a) 255 (b) 99 (c) 1000 (d) 100
  11. 11.What does font-weight do? (a) picks the font style (b) centres a heading (c) makes the text bold (d) colours behind the text
  12. 12.⚖️ What colour is the text of this element?
    <p class="note" id="end">Hi</p>
    CSS:
    #end { color: red; }
    #end { color: blue; }
    (a) green (b) red (c) purple (d) blue
  13. 13.🎯 Which element does the selector #logo style? (a) <div class="box"> (b) <li id="end"> (c) <li id="logo"> (d) <li class="logo">
  14. 14.⚖️ What colour is the text of this element?
    <h2 class="star" id="top">Hi</h2>
    CSS:
    h2 { color: purple; }
    h2 { color: white; }
    (a) red (b) white (c) purple (d) yellow
  15. 15.💪 Which justify-content value puts boxes in the middle? (a) center (b) space-between (c) flex-end (d) flex-start
  16. 16.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 80px;
      padding: 30px;
      border: 4px solid black;
      margin: 5px;
    }
  17. 17.🧩 Which language adds space around boxes? (a) CSS (b) HTML (c) JavaScript
  18. 18.🎯 Which element does the selector div style? (a) <div class="note"> (b) <h1 id="logo"> (c) <span> (d) <p class="note">
  19. 19.🌈 Which colour is rgb(255, 0, 0)? (a) cyan (b) white (c) red (d) magenta
  20. 20.🎯 Which element does the selector #logo style? (a) <p class="logo"> (b) <h1 class="note"> (c) <p id="end"> (d) <p id="logo">
  21. 21.⚖️ What colour is the text of this element?
    <p class="big" id="hero">Hi</p>
    CSS:
    .big { color: white; }
    .big { color: black; }
    (a) white (b) black (c) red (d) yellow
  22. 22.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 26px;
      }
    }
  23. 23.🌈 Which hex code is cyan? (a) #00ff00 (b) #ff0000 (c) #ff00ff (d) #00ffff
  24. 24.🎨 One CSS file can style how many pages? (a) no pages (b) many pages (c) only one image (d) only one word
  25. 25.🌈 In #rrggbb, which colour do the last two digits give? (a) blue (b) white (c) red (d) green
  26. 26.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 300px;
      justify-content: center;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  27. 27.What does justify-content: center do? (a) puts boxes in the middle (b) equal gaps, none at ends (c) packs boxes at the start (d) packs boxes at the end
  28. 28.🌈 Which hex code is red? (a) #ff0000 (b) #ffff00 (c) #0000ff (d) #00ffff
  29. 29.🎯 Which CSS selector matches this element?
    <div class="box" id="top">Hello</div>
    (a) #intro (b) div (c) .star (d) .top
  30. 30.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 18px;
      }
    }
  31. 31.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      font-style: italic;
      margin: 10px;
      color: red;
      font-size: 20px;
    }
  32. 32.⚖️ What colour is the text of this element?
    <h2 class="note" id="intro">Hi</h2>
    CSS:
    #intro { color: purple; }
    #intro { color: red; }
    (a) black (b) purple (c) red (d) yellow
  33. 33.⚖️ What colour is the text of this element?
    <h1 class="red" id="main">Hi</h1>
    CSS:
    #main { color: orange; }
    .red { color: black; }
    (a) black (b) red (c) blue (d) orange
  34. 34.⚖️ What colour is the text of this element?
    <p class="red" id="intro">Hi</p>
    CSS:
    .red { color: yellow; }
    .red { color: white; }
    (a) yellow (b) white (c) green (d) red
  35. 35.What does text-align do? (a) sets the letter colour (b) picks the font style (c) centres a heading (d) colours behind the text
  36. 36.🌈 In #rrggbb, which colour do the first two digits give? (a) black (b) green (c) red (d) blue
  37. 37.🧩 Which language reacts to a button click? (a) CSS (b) HTML (c) JavaScript
  38. 38.🌈 Which colour is #0000ff? (a) blue (b) cyan (c) red (d) white
  39. 39.✍️ Which sign ends each CSS declaration? (a) , (b) . (c) ; (d) :
  40. 40.✍️ Which sign goes between a property and its value? (a) - (b) = (c) ; (d) :

Answer key

  1. 10
  2. purple
  3. False
  4. flex-start
  5. <h2 id="main">
  6. red
  7. 20px
  8. 12
  9. { }
  10. 255
  11. makes the text bold
  12. blue
  13. <li id="logo">
  14. white
  15. center
  16. 158
  17. CSS
  18. <div class="note">
  19. red
  20. <p id="logo">
  21. black
  22. 26
  23. #00ffff
  24. many pages
  25. blue
  26. 70
  27. puts boxes in the middle
  28. #ff0000
  29. div
  30. 12
  31. 4
  32. red
  33. orange
  34. white
  35. centres a heading
  36. red
  37. JavaScript
  38. blue
  39. ;
  40. :

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