← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 658 · 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 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 28px;
      }
    }
  2. 2.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 210px;
      padding: 25px;
      border: 2px solid black;
      margin: 10px;
    }
  3. 3.🌈 Which colour of light is strongest in rgb(62, 61, 255)? (a) green (b) red (c) blue
  4. 4.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      font-style: italic;
      color: red;
      padding: 8px;
    }
  5. 5.💪 Which flexbox property lines boxes up across? (a) display: flex (b) flex-direction (c) gap (d) align-items
  6. 6.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 150px;
      padding: 25px;
      border: 1px solid black;
      margin: 15px;
    }
  7. 7.🧩 Which language checks a quiz answer? (a) JavaScript (b) CSS (c) HTML
  8. 8.True or false: #hero is an id selector. (a) False (b) True
  9. 9.✍️ How does a CSS comment start? (a) # (b) // (c) /* (d) <!--
  10. 10.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 14px;
      }
    }
    (a) Yes (b) No
  11. 11.✍️ Which property is set to red in this rule?
    h2 {
      text-align: center;
      color: red;
      font-style: italic;
      margin: 10px;
    }
    (a) red (b) font-size (c) color (d) text-align
  12. 12.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 280px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  13. 13.🖌️ What colour is behind the letters?
    p {
      font-size: 40px;
      text-align: left;
      color: yellow;
      background-color: blue;
    }
    (a) blue (b) red (c) yellow
  14. 14.✍️ Which property is set to 20px in this rule?
    .note {
      font-size: 20px;
      font-style: italic;
    }
    (a) text-align (b) background-color (c) 20px (d) font-size
  15. 15.⚖️ What colour is the text of this element?
    <h2 class="note" id="top">Hi</h2>
    CSS:
    #top { color: yellow; }
    .note { color: purple; }
    h2 { color: green; }
    (a) purple (b) yellow (c) green (d) blue
  16. 16.🖌️ Which CSS property colours behind the text? (a) background-color (b) font-weight (c) text-align (d) font-size
  17. 17.🎯 Which CSS selector matches this element?
    <p class="star" id="hero">Hello</p>
    (a) #top (b) .menu (c) .star (d) .hero
  18. 18.What does justify-content: flex-start do? (a) packs boxes at the end (b) puts boxes in the middle (c) equal gaps, none at ends (d) packs boxes at the start
  19. 19.✍️ What is the selector in this CSS rule?
    .note {
      font-style: italic;
      font-size: 20px;
      background-color: yellow;
      text-align: center;
    }
    (a) font-style (b) #top (c) 20px (d) .note
  20. 20.Which of these is margin? (a) a solid or dotted edge (b) the gap round content (c) space inside the border (d) space outside the border
  21. 21.📱 min-width: 800px applies when the screen is ___. (a) turned off (b) 800px or wider (c) 800px or narrower (d) exactly 100px
  22. 22.⚖️ What colour is the text of this element?
    <h2 class="box" id="main">Hi</h2>
    CSS:
    h2 { color: blue; }
    #main { color: green; }
    (a) white (b) blue (c) green (d) purple
  23. 23.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 22px;
      }
    }
    (a) Yes (b) No
  24. 24.🧩 Which language makes headings and lists? (a) CSS (b) JavaScript (c) HTML
  25. 25.🖌️ What colour are the letters?
    li {
      text-align: left;
      background-color: black;
      font-size: 20px;
      color: red;
    }
    (a) blue (b) black (c) red
  26. 26.True or false: padding is the gap round content. (a) False (b) True
  27. 27.🎯 Which element does the selector #main style? (a) <p id="logo"> (b) <p class="main"> (c) <h1 class="box"> (d) <p id="main">
  28. 28.🖌️ Where does the text sit on its line?
    h2 {
      color: yellow;
      background-color: blue;
      text-align: center;
      font-size: 16px;
    }
    (a) on the right (b) on the left (c) in the middle
  29. 29.🔍 Which is the odd one out? (a) lays out the page (b) reacts to a button click (c) changes the page live (d) counts down a timer
  30. 30.✍️ Which sign ends each CSS declaration? (a) : (b) , (c) ; (d) .
  31. 31.🧩 Which language rounds box corners? (a) CSS (b) HTML (c) JavaScript
  32. 32.🎯 Which element does the selector .menu style? (a) <h2 class="big"> (b) <h1 id="menu"> (c) <h1 class="menu"> (d) <h1 class="note">
  33. 33.✍️ What is the selector in this CSS rule?
    .note {
      margin: 10px;
      width: 300px;
      background-color: yellow;
    }
    (a) 300px (b) margin (c) #top (d) .note
  34. 34.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 14px;
      }
    }
    (a) No (b) Yes
  35. 35.⚖️ Which selector is the strongest? (a) a class selector (b) an element selector (c) an id selector
  36. 36.🎨 What does CSS stand for? (a) Colourful Site Styles (b) Creative Sheet System (c) Cascading Style Sheets (d) Computer Style Sheets
  37. 37.🎯 Can many elements share the same class? (a) Yes (b) No
  38. 38.🌈 Which colour is rgb(0, 255, 0)? (a) cyan (b) red (c) bright green (d) white
  39. 39.🖌️ What colour are the letters?
    h1 {
      text-align: right;
      font-size: 36px;
      background-color: red;
      color: orange;
    }
    (a) yellow (b) red (c) orange
  40. 40.🌈 Which colour is #000000? (a) blue (b) black (c) yellow (d) bright green

Answer key

  1. 20
  2. 284
  3. blue
  4. 3
  5. align-items
  6. 202
  7. JavaScript
  8. True
  9. /*
  10. No
  11. color
  12. 40
  13. blue
  14. font-size
  15. yellow
  16. background-color
  17. .star
  18. packs boxes at the start
  19. .note
  20. space outside the border
  21. 800px or wider
  22. green
  23. Yes
  24. HTML
  25. red
  26. True
  27. <p id="main">
  28. in the middle
  29. lays out the page
  30. ;
  31. CSS
  32. <h1 class="menu">
  33. .note
  34. Yes
  35. an id selector
  36. Cascading Style Sheets
  37. Yes
  38. bright green
  39. orange
  40. black

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