← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 388 · 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.💪 Which justify-content value puts boxes in the middle? (a) flex-start (b) flex-end (c) center (d) space-between
  2. 2.⚖️ What colour is the text of this element?
    <h1 class="star" id="logo">Hi</h1>
    CSS:
    h1 { color: yellow; }
    h1 { color: orange; }
    (a) green (b) blue (c) yellow (d) orange
  3. 3.🖌️ Which CSS property colours behind the text? (a) background-color (b) text-align (c) color (d) font-size
  4. 4.📱 min-width: 800px applies when the screen is ___. (a) 800px or wider (b) exactly 100px (c) 800px or narrower (d) turned off
  5. 5.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 340px;
      justify-content: space-between;
    }
    Inside are 3 boxes, each 80px wide (no margins).
  6. 6.✍️ CSS declarations go inside which brackets? (a) ( ) (b) { } (c) [ ] (d) < >
  7. 7.📱 What does a media query check? (a) the time of day (b) the page title (c) the battery level (d) the screen width
  8. 8.⚖️ What colour is the text of this element?
    <p class="menu" id="top">Hi</p>
    CSS:
    .menu { color: red; }
    #top { color: purple; }
    p { color: black; }
    (a) black (b) blue (c) purple (d) red
  9. 9.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 3 (b) 2 (c) 4 (d) 6
  10. 10.✍️ Which property is set to italic in this rule?
    .box {
      font-style: italic;
      padding: 8px;
    }
    (a) font-style (b) italic (c) font-size (d) color
  11. 11.🔍 Which is the odd one out? (a) shows a pop-up message (b) changes the page live (c) makes a form box (d) counts down a timer
  12. 12.💪 Which justify-content value equal gaps, none at ends? (a) flex-start (b) center (c) space-between (d) flex-end
  13. 13.⚖️ What colour is the text of this element?
    <h1 class="note" id="logo">Hi</h1>
    CSS:
    #logo { color: black; }
    #logo { color: green; }
    (a) green (b) black (c) red (d) yellow
  14. 14.🎯 Which element does the selector #intro style? (a) <h1 class="intro"> (b) <h1 id="main"> (c) <h1 id="intro"> (d) <h2 class="big">
  15. 15.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 300px;
      padding: 5px;
      border: 3px solid black;
      margin: 15px;
    }
  16. 16.Which of these does HTML do? (a) changes the page live (b) shows a pop-up message (c) makes headings and lists (d) reacts to a button click
  17. 17.🎨 One CSS file can style how many pages? (a) no pages (b) only one image (c) only one word (d) many pages
  18. 18.True or false: CSS makes a link. (a) False (b) True
  19. 19.🎨 A CSS file usually ends with which extension? (a) .js (b) .html (c) .png (d) .css
  20. 20.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 14px;
      }
    }
    (a) Yes (b) No
  21. 21.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 22px;
      }
    }
  22. 22.🌈 In #rrggbb, which colour do the first two digits give? (a) black (b) green (c) red (d) blue
  23. 23.⚖️ What colour is the text of this element?
    <p class="big" id="logo">Hi</p>
    CSS:
    p { color: white; }
    p { color: green; }
    (a) blue (b) red (c) white (d) green
  24. 24.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 230px;
      padding: 25px;
      border: 4px solid black;
      margin: 5px;
    }
  25. 25.⚖️ What colour is the text of this element?
    <p class="red" id="end">Hi</p>
    CSS:
    .red { color: orange; }
    .red { color: white; }
    (a) purple (b) green (c) orange (d) white
  26. 26.🧩 Which language changes the page live? (a) CSS (b) HTML (c) JavaScript
  27. 27.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) the first one (c) neither (d) the later one
  28. 28.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 130px;
      justify-content: flex-end;
    }
    Inside are 3 boxes, each 40px wide (no margins).
  29. 29.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 260px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  30. 30.Which of these is margin? (a) space inside the border (b) a solid or dotted edge (c) the gap to other boxes (d) the line round the box
  31. 31.⚖️ What colour is the text of this element?
    <h1 class="note" id="end">Hi</h1>
    CSS:
    h1 { color: black; }
    #end { color: purple; }
    (a) black (b) orange (c) purple (d) green
  32. 32.💪 Which flexbox property turns on flexbox? (a) display: flex (b) gap (c) flex-direction (d) align-items
  33. 33.📦 In the box model, which part is the line round the box? (a) margin (b) padding (c) content (d) border
  34. 34.🖌️ Which CSS property sets the letter colour? (a) font-family (b) font-weight (c) background-color (d) color
  35. 35.Which of these does CSS do? (a) changes the text size (b) checks a quiz answer (c) gives the page structure (d) reacts to a button click
  36. 36.🧩 Which language counts down a timer? (a) CSS (b) JavaScript (c) HTML
  37. 37.🎯 Which CSS selector matches this element?
    <li class="red" id="main">Hello</li>
    (a) .main (b) li (c) .box (d) #red
  38. 38.⚖️ What colour is the text of this element?
    <p class="note" id="top">Hi</p>
    CSS:
    p { color: orange; }
    #top { color: blue; }
    .note { color: yellow; }
    (a) yellow (b) orange (c) black (d) blue
  39. 39.✍️ Which property is set to center in this rule?
    h1 {
      text-align: center;
      background-color: yellow;
      margin: 10px;
      font-style: italic;
    }
    (a) background-color (b) text-align (c) center (d) margin
  40. 40.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 440px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 80px wide (no margins).

Answer key

  1. center
  2. orange
  3. background-color
  4. 800px or wider
  5. 50
  6. { }
  7. the screen width
  8. purple
  9. 3
  10. font-style
  11. makes a form box
  12. space-between
  13. green
  14. <h1 id="intro">
  15. 346
  16. makes headings and lists
  17. many pages
  18. False
  19. .css
  20. Yes
  21. 24
  22. red
  23. green
  24. 298
  25. white
  26. JavaScript
  27. the later one
  28. 10
  29. 60
  30. the gap to other boxes
  31. purple
  32. display: flex
  33. border
  34. color
  35. changes the text size
  36. JavaScript
  37. li
  38. blue
  39. text-align
  40. 40

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