← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 657 · 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.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the later one (b) neither (c) the first one (d) the shorter one
  2. 2.💪 Which flexbox property picks row or column? (a) gap (b) justify-content (c) flex-direction (d) align-items
  3. 3.True or false: #main is an id selector. (a) False (b) True
  4. 4.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 260px;
      justify-content: flex-end;
    }
    Inside are 3 boxes, each 60px wide (no margins).
  5. 5.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 24px;
      }
    }
  6. 6.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      text-align: center;
      color: red;
    }
  7. 7.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 22px;
      }
    }
  8. 8.🔍 Which is the odd one out? (a) sets colours and fonts (b) counts down a timer (c) changes the text size (d) rounds box corners
  9. 9.🌈 In #rrggbb, which colour do the first two digits give? (a) red (b) green (c) blue (d) black
  10. 10.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 14px;
      }
    }
  11. 11.🎨 Which tag connects an outside CSS file? (a) <img> (b) <a> (c) <css> (d) <link>
  12. 12.True or false: margin is the gap round content. (a) False (b) True
  13. 13.🌈 Which colour is #000000? (a) magenta (b) red (c) black (d) bright green
  14. 14.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      padding: 8px;
    }
  15. 15.🔍 Which is the odd one out? (a) sets colours and fonts (b) puts a picture on a page (c) makes a form box (d) makes headings and lists
  16. 16.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 160px;
      padding: 15px;
      border: 5px solid black;
      margin: 0px;
    }
  17. 17.✍️ What is the selector in this CSS rule?
    h1 {
      padding: 8px;
      font-size: 20px;
    }
    (a) 20px (b) padding (c) h1 (d) p
  18. 18.🎯 Which sign starts an id selector? (a) @ (b) & (c) . (d) #
  19. 19.🖌️ What colour are the letters?
    h1 {
      color: orange;
      text-align: right;
      font-size: 20px;
      background-color: white;
    }
    (a) orange (b) white (c) red
  20. 20.🖌️ What colour are the letters?
    h1 {
      background-color: red;
      font-size: 40px;
      text-align: left;
      color: orange;
    }
    (a) green (b) red (c) orange
  21. 21.What does font-size do? (a) makes the text bold (b) sets the letter colour (c) makes letters bigger (d) picks the font style
  22. 22.🌈 Which colour of light is strongest in rgb(158, 3, 102)? (a) blue (b) red (c) green
  23. 23.📦 In the box model, which part is space inside the border? (a) content (b) border (c) padding (d) margin
  24. 24.🎨 One CSS file can style how many pages? (a) only one image (b) no pages (c) many pages (d) only one word
  25. 25.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      background-color: yellow;
      font-style: italic;
    }
  26. 26.⚖️ What colour is the text of this element?
    <p class="big" id="logo">Hi</p>
    CSS:
    p { color: blue; }
    #logo { color: red; }
    .big { color: green; }
    (a) red (b) purple (c) blue (d) green
  27. 27.True or false: #main is a class selector. (a) True (b) False
  28. 28.🎯 Which element does the selector .menu style? (a) <h2 class="menu"> (b) <li class="big"> (c) <h2 id="menu"> (d) <h2 class="note">
  29. 29.🧩 Which language sets colours and fonts? (a) JavaScript (b) CSS (c) HTML
  30. 30.🖌️ What colour are the letters?
    h2 {
      color: purple;
      background-color: orange;
      text-align: left;
      font-size: 12px;
    }
    (a) blue (b) orange (c) purple
  31. 31.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 130px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  32. 32.🌈 In #rrggbb, which colour do the last two digits give? (a) white (b) green (c) blue (d) red
  33. 33.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 90px;
      padding: 25px;
      border: 3px solid black;
      margin: 15px;
    }
  34. 34.True or false: the border is the gap to other boxes. (a) True (b) False
  35. 35.📱 Which tag helps phones show a page at the right size? (a) the title tag (b) the br tag (c) the viewport meta tag (d) the hr tag
  36. 36.✍️ What value is given to border in this rule?
    #top {
      border: 2px solid;
      font-weight: bold;
    }
    (a) 2px solid (b) 300px (c) border (d) italic
  37. 37.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 460px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 100px wide (no margins).
  38. 38.🌈 Which colour is rgb(0, 255, 0)? (a) black (b) yellow (c) red (d) bright green
  39. 39.🎯 What kind of selector is #logo? (a) a class selector (b) an id selector (c) an element selector
  40. 40.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 320px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 60px wide (no margins).

Answer key

  1. the later one
  2. flex-direction
  3. True
  4. 80
  5. 24
  6. 2
  7. 22
  8. counts down a timer
  9. red
  10. 12
  11. <link>
  12. False
  13. black
  14. 1
  15. sets colours and fonts
  16. 200
  17. h1
  18. #
  19. orange
  20. orange
  21. makes letters bigger
  22. red
  23. padding
  24. many pages
  25. 2
  26. red
  27. False
  28. <h2 class="menu">
  29. CSS
  30. purple
  31. 50
  32. blue
  33. 176
  34. False
  35. the viewport meta tag
  36. 2px solid
  37. 60
  38. bright green
  39. an id selector
  40. 80

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