← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 4 · 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 700px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 6px;
      }
    }
    (a) No (b) Yes
  2. 2.✍️ What value is given to color in this rule?
    li {
      margin: 10px;
      color: red;
      padding: 8px;
      font-size: 20px;
    }
    (a) color (b) 20px (c) center (d) red
  3. 3.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 230px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 60px wide (no margins).
  4. 4.🌈 Hex digits go 0 to 9, then A to which letter? (a) J (b) Z (c) F (d) G
  5. 5.💪 Which justify-content value puts boxes in the middle? (a) flex-end (b) flex-start (c) space-between (d) center
  6. 6.🧩 Which language makes a link? (a) HTML (b) CSS (c) JavaScript
  7. 7.⚖️ Two rules with the same selector set a colour. Which one wins? (a) neither (b) the first one (c) the shorter one (d) the later one
  8. 8.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 22px;
      }
    }
  9. 9.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 6px;
      }
    }
  10. 10.Which of these is the border? (a) space inside the border (b) the line round the box (c) the gap to other boxes (d) space outside the border
  11. 11.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 24px;
      }
    }
    (a) Yes (b) No
  12. 12.📦 In the box model, which part is the gap to other boxes? (a) border (b) margin (c) content (d) padding
  13. 13.✍️ Which property is set to 300px in this rule?
    h2 {
      width: 300px;
      font-style: italic;
      color: red;
      margin: 10px;
    }
    (a) color (b) width (c) 300px (d) font-style
  14. 14.🎯 Which element does the selector .star style? (a) <h1 class="menu"> (b) <h2 class="note"> (c) <h1 class="star"> (d) <h1 id="star">
  15. 15.⚖️ Which selector is the strongest? (a) an id selector (b) a class selector (c) an element selector
  16. 16.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 20px;
      }
    }
    (a) Yes (b) No
  17. 17.🎯 Which element does the selector #top style? (a) <li class="top"> (b) <li id="intro"> (c) <li id="top"> (d) <div class="menu">
  18. 18.⚖️ What colour is the text of this element?
    <p class="box" id="intro">Hi</p>
    CSS:
    p { color: yellow; }
    p { color: white; }
    (a) orange (b) yellow (c) green (d) white
  19. 19.📱 max-width: 600px applies when the screen is ___. (a) 600px or wider (b) exactly 1000px (c) turned off (d) 600px or narrower
  20. 20.📱 Responsive design means a page ___. (a) fits every screen (b) is only for laptops (c) has no pictures (d) never changes
  21. 21.✍️ How many declarations (property: value pairs) are in this rule?
    .box {
      border: 2px solid;
      font-weight: bold;
      font-style: italic;
    }
  22. 22.🎯 Which element does the selector #intro style? (a) <span class="intro"> (b) <span id="main"> (c) <p class="big"> (d) <span id="intro">
  23. 23.🎯 What kind of selector is .big? (a) an id selector (b) a class selector (c) an element selector
  24. 24.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 50px;
      padding: 25px;
      border: 1px solid black;
      margin: 15px;
    }
  25. 25.✍️ In color: blue; which part is the value? (a) color (b) blue (c) ; (d) :
  26. 26.⚖️ What colour is the text of this element?
    <h1 class="box" id="logo">Hi</h1>
    CSS:
    #logo { color: yellow; }
    .box { color: black; }
    (a) black (b) yellow (c) red (d) blue
  27. 27.🖌️ What colour are the letters?
    p {
      background-color: black;
      color: orange;
      text-align: right;
      font-size: 12px;
    }
    (a) black (b) green (c) orange
  28. 28.🖌️ Which CSS property picks the font style? (a) color (b) background-color (c) font-family (d) font-weight
  29. 29.🎨 What does CSS stand for? (a) Computer Style Sheets (b) Creative Sheet System (c) Colourful Site Styles (d) Cascading Style Sheets
  30. 30.True or false: .note is an id selector. (a) True (b) False
  31. 31.🎨 A CSS file usually ends with which extension? (a) .png (b) .css (c) .html (d) .js
  32. 32.🔍 Which is the odd one out? (a) reacts to a button click (b) gives the page structure (c) puts a picture on a page (d) makes a form box
  33. 33.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 220px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 60px wide (no margins).
  34. 34.🖌️ What colour are the letters?
    h2 {
      text-align: left;
      color: red;
      background-color: purple;
      font-size: 40px;
    }
    (a) white (b) red (c) purple
  35. 35.📱 The screen is 820px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 22px;
      }
    }
    (a) Yes (b) No
  36. 36.🖌️ Where does the text sit on its line?
    li {
      text-align: right;
      font-size: 16px;
      background-color: red;
      color: blue;
    }
    (a) on the left (b) in the middle (c) on the right
  37. 37.🌈 In #0000dd the blue part is the hex number dd. What is it as a normal number?
  38. 38.📱 The screen is 1366px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 28px;
      }
    }
    (a) No (b) Yes
  39. 39.🌈 What is the biggest number one colour can have in rgb()? (a) 99 (b) 100 (c) 1000 (d) 255
  40. 40.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 6px;
      }
    }

Answer key

  1. Yes
  2. red
  3. 50
  4. F
  5. center
  6. HTML
  7. the later one
  8. 22
  9. 12
  10. the line round the box
  11. No
  12. margin
  13. width
  14. <h1 class="star">
  15. an id selector
  16. No
  17. <li id="top">
  18. white
  19. 600px or narrower
  20. fits every screen
  21. 3
  22. <span id="intro">
  23. a class selector
  24. 132
  25. blue
  26. yellow
  27. orange
  28. font-family
  29. Cascading Style Sheets
  30. False
  31. .css
  32. reacts to a button click
  33. 40
  34. red
  35. Yes
  36. on the right
  37. 221
  38. Yes
  39. 255
  40. 6

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