← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 479 · 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.🖌️ Where does the text sit on its line?
    li {
      background-color: orange;
      font-size: 20px;
      text-align: right;
      color: red;
    }
    (a) on the right (b) in the middle (c) on the left
  2. 2.🎨 One CSS file can style how many pages? (a) only one word (b) many pages (c) only one image (d) no pages
  3. 3.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 70px;
      padding: 5px;
      border: 4px solid black;
      margin: 0px;
    }
  4. 4.🧩 Which language gives the page structure? (a) CSS (b) JavaScript (c) HTML
  5. 5.✍️ In color: blue; which part is the value? (a) blue (b) : (c) color (d) ;
  6. 6.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 30px;
      }
    }
    (a) No (b) Yes
  7. 7.🎯 Which CSS selector matches this element?
    <p class="menu" id="end">Hello</p>
    (a) .note (b) .menu (c) .end (d) #menu
  8. 8.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 14px;
      }
    }
  9. 9.🧩 Which language sets colours and fonts? (a) CSS (b) HTML (c) JavaScript
  10. 10.🖌️ Which CSS property picks the font style? (a) font-weight (b) color (c) font-size (d) font-family
  11. 11.🌈 Which colour is rgb(0, 255, 255)? (a) cyan (b) bright green (c) yellow (d) magenta
  12. 12.True or false: #logo is a class selector. (a) True (b) False
  13. 13.🖌️ Where does the text sit on its line?
    h1 {
      text-align: right;
      color: red;
      background-color: purple;
      font-size: 32px;
    }
    (a) in the middle (b) on the left (c) on the right
  14. 14.🖌️ What colour are the letters?
    h1 {
      text-align: right;
      font-size: 12px;
      background-color: green;
      color: yellow;
    }
    (a) green (b) yellow (c) white
  15. 15.📱 Responsive design means a page ___. (a) never changes (b) has no pictures (c) fits every screen (d) is only for laptops
  16. 16.⚖️ What colour is the text of this element?
    <h1 class="star" id="intro">Hi</h1>
    CSS:
    .star { color: yellow; }
    .star { color: orange; }
    (a) red (b) green (c) orange (d) yellow
  17. 17.🎯 Which element does the selector .box style? (a) <h2 id="box"> (b) <h2 class="box"> (c) <li class="menu"> (d) <h2 class="star">
  18. 18.⚖️ Which selector is the weakest? (a) an id selector (b) an element selector (c) a class selector
  19. 19.📱 max-width: 600px applies when the screen is ___. (a) exactly 1000px (b) turned off (c) 600px or narrower (d) 600px or wider
  20. 20.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 60px;
      padding: 5px;
      border: 2px solid black;
      margin: 10px;
    }
  21. 21.Which of these is padding? (a) space outside the border (b) space inside the border (c) the text or picture (d) the gap to other boxes
  22. 22.🧩 Which language lays out the page? (a) JavaScript (b) CSS (c) HTML
  23. 23.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 3 (b) 4 (c) 2 (d) 6
  24. 24.💪 Which flexbox property turns on flexbox? (a) justify-content (b) display: flex (c) align-items (d) flex-direction
  25. 25.True or false: JavaScript shows a pop-up message. (a) True (b) False
  26. 26.🖌️ What colour is behind the letters?
    h2 {
      text-align: left;
      font-size: 16px;
      background-color: blue;
      color: purple;
    }
    (a) blue (b) purple (c) green
  27. 27.What does font-size do? (a) sets the letter colour (b) centres a heading (c) picks the font style (d) makes letters bigger
  28. 28.🎨 A CSS file usually ends with which extension? (a) .js (b) .png (c) .html (d) .css
  29. 29.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) the later one (c) the first one (d) neither
  30. 30.💪 Which justify-content value packs boxes at the end? (a) center (b) flex-end (c) space-between (d) flex-start
  31. 31.✍️ How does a CSS comment start? (a) // (b) <!-- (c) /* (d) #
  32. 32.🖌️ What colour is behind the letters?
    h2 {
      text-align: right;
      color: yellow;
      background-color: orange;
      font-size: 40px;
    }
    (a) orange (b) yellow (c) red
  33. 33.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 18px;
      }
    }
    (a) Yes (b) No
  34. 34.🎯 Which element does the selector .red style? (a) <span class="red"> (b) <span id="red"> (c) <span class="box"> (d) <p class="star">
  35. 35.🖌️ Where does the text sit on its line?
    h2 {
      color: white;
      text-align: center;
      background-color: red;
      font-size: 28px;
    }
    (a) on the right (b) on the left (c) in the middle
  36. 36.🖌️ Where does the text sit on its line?
    h1 {
      background-color: orange;
      text-align: right;
      font-size: 32px;
      color: purple;
    }
    (a) in the middle (b) on the right (c) on the left
  37. 37.⚖️ What colour is the text of this element?
    <h1 class="note" id="logo">Hi</h1>
    CSS:
    .note { color: white; }
    .note { color: green; }
    (a) green (b) white (c) purple (d) black
  38. 38.🌈 In #rrggbb, which colour do the first two digits give? (a) green (b) red (c) black (d) blue
  39. 39.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 170px;
      justify-content: flex-end;
    }
    Inside are 3 boxes, each 50px wide (no margins).
  40. 40.🌈 Which colour of light is strongest in rgb(156, 132, 114)? (a) green (b) red (c) blue

Answer key

  1. on the right
  2. many pages
  3. 88
  4. HTML
  5. blue
  6. No
  7. .menu
  8. 12
  9. CSS
  10. font-family
  11. cyan
  12. False
  13. on the right
  14. yellow
  15. fits every screen
  16. orange
  17. <h2 class="box">
  18. an element selector
  19. 600px or narrower
  20. 94
  21. space inside the border
  22. CSS
  23. 3
  24. display: flex
  25. True
  26. blue
  27. makes letters bigger
  28. .css
  29. the later one
  30. flex-end
  31. /*
  32. orange
  33. No
  34. <span class="red">
  35. in the middle
  36. on the right
  37. green
  38. red
  39. 20
  40. red

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