← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 272 · 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.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 250px;
      padding: 20px;
      border: 4px solid black;
      margin: 10px;
    }
  2. 2.🧩 Which language reacts to a button click? (a) HTML (b) JavaScript (c) CSS
  3. 3.🔍 Which is the odd one out? (a) lays out the page (b) sets colours and fonts (c) checks a quiz answer (d) rounds box corners
  4. 4.⚖️ What colour is the text of this element?
    <h1 class="red" id="hero">Hi</h1>
    CSS:
    h1 { color: orange; }
    #hero { color: white; }
    .red { color: red; }
    (a) red (b) orange (c) white (d) blue
  5. 5.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 14px;
      }
    }
    (a) No (b) Yes
  6. 6.✍️ Which property is set to yellow in this rule?
    h1 {
      text-align: center;
      background-color: yellow;
      font-size: 20px;
      color: red;
    }
    (a) margin (b) background-color (c) padding (d) yellow
  7. 7.✍️ What is the selector in this CSS rule?
    .note {
      font-style: italic;
      font-size: 20px;
    }
    (a) 20px (b) #top (c) .note (d) font-style
  8. 8.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 160px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  9. 9.🎯 Which CSS selector matches this element?
    <li class="big" id="hero">Hello</li>
    (a) .red (b) #big (c) li (d) div
  10. 10.⚖️ Which selector is the strongest? (a) an id selector (b) a class selector (c) an element selector
  11. 11.🧩 Which language puts a picture on a page? (a) CSS (b) JavaScript (c) HTML
  12. 12.🎯 Which element does the selector #top style? (a) <li id="intro"> (b) <li class="top"> (c) <li id="top"> (d) <div class="note">
  13. 13.🔍 Which is the odd one out? (a) checks a quiz answer (b) sets colours and fonts (c) counts down a timer (d) reacts to a button click
  14. 14.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 22px;
      }
    }
    (a) Yes (b) No
  15. 15.🖌️ What colour are the letters?
    h1 {
      font-size: 12px;
      color: green;
      text-align: right;
      background-color: purple;
    }
    (a) black (b) purple (c) green
  16. 16.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 160px;
      padding: 25px;
      border: 3px solid black;
      margin: 15px;
    }
  17. 17.🎨 What does CSS stand for? (a) Computer Style Sheets (b) Creative Sheet System (c) Colourful Site Styles (d) Cascading Style Sheets
  18. 18.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 80px;
      padding: 5px;
      border: 2px solid black;
      margin: 0px;
    }
  19. 19.🌈 In #260000 the red part is the hex number 26. What is it as a normal number?
  20. 20.🌈 Which colour of light is strongest in rgb(245, 68, 126)? (a) blue (b) red (c) green
  21. 21.⚖️ What colour is the text of this element?
    <p class="menu" id="end">Hi</p>
    CSS:
    .menu { color: red; }
    .menu { color: black; }
    (a) blue (b) red (c) black (d) purple
  22. 22.True or false: HTML reacts to a button click. (a) False (b) True
  23. 23.🖌️ What colour are the letters?
    p {
      font-size: 36px;
      background-color: white;
      color: yellow;
      text-align: center;
    }
    (a) white (b) yellow (c) green
  24. 24.⚖️ What colour is the text of this element?
    <h2 class="star" id="intro">Hi</h2>
    CSS:
    #intro { color: orange; }
    .star { color: purple; }
    (a) white (b) purple (c) green (d) orange
  25. 25.✍️ Which sign ends each CSS declaration? (a) . (b) ; (c) : (d) ,
  26. 26.🖌️ Which CSS property picks the font style? (a) font-size (b) color (c) font-family (d) font-weight
  27. 27.True or false: HTML counts down a timer. (a) False (b) True
  28. 28.✍️ Which property is set to red in this rule?
    .note {
      text-align: center;
      color: red;
    }
    (a) text-align (b) color (c) red (d) font-size
  29. 29.📱 Responsive design means a page ___. (a) is only for laptops (b) never changes (c) fits every screen (d) has no pictures
  30. 30.🌈 Which colour is rgb(0, 255, 255)? (a) cyan (b) red (c) white (d) black
  31. 31.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 560px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 80px wide (no margins).
  32. 32.Which of these is padding? (a) the gap round content (b) a solid or dotted edge (c) the text or picture (d) the gap to other boxes
  33. 33.📱 What does a media query check? (a) the battery level (b) the time of day (c) the page title (d) the screen width
  34. 34.✍️ How many declarations (property: value pairs) are in this rule?
    .box {
      color: red;
      margin: 10px;
    }
  35. 35.🎯 Which CSS selector matches this element?
    <p class="big" id="intro">Hello</p>
    (a) #intro (b) .intro (c) #main (d) #big
  36. 36.✍️ Which property is set to italic in this rule?
    li {
      margin: 10px;
      font-style: italic;
    }
    (a) font-size (b) italic (c) font-style (d) color
  37. 37.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 30px;
      }
    }
    (a) No (b) Yes
  38. 38.💪 Which flexbox property lines boxes up across? (a) justify-content (b) gap (c) display: flex (d) align-items
  39. 39.True or false: h1 is an id selector. (a) True (b) False
  40. 40.💪 Which justify-content value packs boxes at the start? (a) flex-end (b) center (c) space-between (d) flex-start

Answer key

  1. 298
  2. JavaScript
  3. checks a quiz answer
  4. white
  5. Yes
  6. background-color
  7. .note
  8. 60
  9. li
  10. an id selector
  11. HTML
  12. <li id="top">
  13. sets colours and fonts
  14. No
  15. green
  16. 246
  17. Cascading Style Sheets
  18. 94
  19. 38
  20. red
  21. black
  22. False
  23. yellow
  24. orange
  25. ;
  26. font-family
  27. False
  28. color
  29. fits every screen
  30. cyan
  31. 80
  32. the gap round content
  33. the screen width
  34. 2
  35. #intro
  36. font-style
  37. No
  38. align-items
  39. False
  40. flex-start

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