← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 415 · 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 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 22px;
      }
    }
  2. 2.✍️ What is the selector in this CSS rule?
    body {
      font-size: 20px;
      font-style: italic;
      color: red;
    }
    (a) font-size (b) .box (c) italic (d) body
  3. 3.🖌️ How big is the text, in px?
    li {
      background-color: white;
      color: orange;
      text-align: left;
      font-size: 36px;
    }
  4. 4.🖌️ Where does the text sit on its line?
    h2 {
      text-align: right;
      font-size: 12px;
      background-color: green;
      color: blue;
    }
    (a) on the right (b) in the middle (c) on the left
  5. 5.🔍 Which is the odd one out? (a) changes the text size (b) makes a link (c) rounds box corners (d) sets colours and fonts
  6. 6.✍️ What value is given to text-align in this rule?
    body {
      text-align: center;
      font-weight: bold;
      padding: 8px;
      border: 2px solid;
    }
    (a) center (b) yellow (c) 10px (d) text-align
  7. 7.⚖️ Which selector is the weakest? (a) a class selector (b) an element selector (c) an id selector
  8. 8.🎯 Which element does the selector h1 style? (a) <h1 class="note"> (b) <li class="note"> (c) <div id="end"> (d) <h2>
  9. 9.📱 What does a media query check? (a) the battery level (b) the time of day (c) the page title (d) the screen width
  10. 10.🌈 In #006900 the green part is the hex number 69. What is it as a normal number?
  11. 11.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 230px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  12. 12.✍️ In color: blue; which part is the property? (a) color (b) blue (c) : (d) ;
  13. 13.✍️ Which property is set to red in this rule?
    body {
      font-size: 20px;
      color: red;
      background-color: yellow;
    }
    (a) font-size (b) red (c) color (d) text-align
  14. 14.Which of these does HTML do? (a) changes the page live (b) puts a picture on a page (c) sets colours and fonts (d) changes the text size
  15. 15.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 190px;
      justify-content: flex-end;
    }
    Inside are 3 boxes, each 60px wide (no margins).
  16. 16.Which of these does HTML do? (a) changes the page live (b) checks a quiz answer (c) rounds box corners (d) makes a link
  17. 17.✍️ Which property is set to yellow in this rule?
    p {
      font-size: 20px;
      text-align: center;
      background-color: yellow;
    }
    (a) padding (b) margin (c) background-color (d) yellow
  18. 18.🌈 Which hex code is cyan? (a) #ffff00 (b) #00ffff (c) #ffffff (d) #ff00ff
  19. 19.⚖️ What colour is the text of this element?
    <h1 class="star" id="logo">Hi</h1>
    CSS:
    .star { color: black; }
    h1 { color: blue; }
    (a) green (b) white (c) black (d) blue
  20. 20.✍️ In color: blue; which part is the value? (a) ; (b) : (c) blue (d) color
  21. 21.🔍 Which is the odd one out? (a) checks a quiz answer (b) changes the text size (c) shows a pop-up message (d) reacts to a button click
  22. 22.What does background-color do? (a) colours behind the text (b) makes letters bigger (c) picks the font style (d) sets the letter colour
  23. 23.✍️ What value is given to border in this rule?
    .note {
      margin: 10px;
      border: 2px solid;
    }
    (a) italic (b) 300px (c) border (d) 2px solid
  24. 24.🖌️ Which CSS property picks the font style? (a) font-family (b) text-align (c) background-color (d) color
  25. 25.⚖️ What colour is the text of this element?
    <h2 class="star" id="hero">Hi</h2>
    CSS:
    #hero { color: purple; }
    #hero { color: white; }
    (a) white (b) yellow (c) purple (d) green
  26. 26.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 270px;
      padding: 25px;
      border: 3px solid black;
      margin: 5px;
    }
  27. 27.🧩 Which language changes the text size? (a) JavaScript (b) CSS (c) HTML
  28. 28.✍️ Which property is set to 8px in this rule?
    h1 {
      font-size: 20px;
      padding: 8px;
    }
    (a) border (b) 8px (c) padding (d) font-weight
  29. 29.Which of these is padding? (a) the gap to other boxes (b) a solid or dotted edge (c) the line round the box (d) the gap round content
  30. 30.True or false: CSS shows a pop-up message. (a) True (b) False
  31. 31.🖌️ What colour is behind the letters?
    li {
      color: yellow;
      font-size: 20px;
      text-align: right;
      background-color: white;
    }
    (a) yellow (b) red (c) white
  32. 32.🎯 Which element does the selector #end style? (a) <span id="end"> (b) <span class="end"> (c) <p class="red"> (d) <span id="hero">
  33. 33.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 180px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 80px wide (no margins).
  34. 34.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 18px;
      }
    }
  35. 35.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 14px;
      }
    }
  36. 36.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 14px;
      }
    }
    (a) Yes (b) No
  37. 37.Which of these does HTML do? (a) changes the text size (b) gives the page structure (c) changes the page live (d) checks a quiz answer
  38. 38.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 28px;
      }
    }
  39. 39.🎨 Which tag connects an outside CSS file? (a) <link> (b) <a> (c) <img> (d) <css>
  40. 40.🎨 Which tag holds CSS inside the head? (a) <css> (b) <script> (c) <style> (d) <body>

Answer key

  1. 16
  2. body
  3. 36
  4. on the right
  5. makes a link
  6. center
  7. an element selector
  8. <h1 class="note">
  9. the screen width
  10. 105
  11. 30
  12. color
  13. color
  14. puts a picture on a page
  15. 10
  16. makes a link
  17. background-color
  18. #00ffff
  19. black
  20. blue
  21. changes the text size
  22. colours behind the text
  23. 2px solid
  24. font-family
  25. white
  26. 326
  27. CSS
  28. padding
  29. the gap round content
  30. False
  31. white
  32. <span id="end">
  33. 20
  34. 18
  35. 16
  36. Yes
  37. gives the page structure
  38. 24
  39. <link>
  40. <style>

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