← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 156 · 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.🌈 In #rrggbb, which colour do the first two digits give? (a) black (b) green (c) blue (d) red
  2. 2.💪 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 60px wide (no margins).
  3. 3.True or false: p is an element selector. (a) False (b) True
  4. 4.🔍 Which is the odd one out? (a) makes headings and lists (b) lays out the page (c) sets colours and fonts (d) rounds box corners
  5. 5.🎨 Which tag connects an outside CSS file? (a) <a> (b) <img> (c) <css> (d) <link>
  6. 6.🎯 What kind of selector is .note? (a) an element selector (b) an id selector (c) a class selector
  7. 7.🖌️ Where does the text sit on its line?
    p {
      text-align: right;
      background-color: yellow;
      color: blue;
      font-size: 12px;
    }
    (a) in the middle (b) on the left (c) on the right
  8. 8.🎯 Which sign starts an id selector? (a) @ (b) . (c) & (d) #
  9. 9.🌈 Which colour is #00ff00? (a) cyan (b) white (c) bright green (d) red
  10. 10.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 140px;
      padding: 20px;
      border: 1px solid black;
      margin: 15px;
    }
  11. 11.🎨 One CSS file can style how many pages? (a) many pages (b) only one image (c) only one word (d) no pages
  12. 12.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 18px;
      }
    }
  13. 13.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 140px;
      padding: 5px;
      border: 1px solid black;
      margin: 15px;
    }
  14. 14.What does background-color do? (a) centres a heading (b) colours behind the text (c) sets the letter colour (d) picks the font style
  15. 15.✍️ What is the selector in this CSS rule?
    .note {
      padding: 8px;
      text-align: center;
      color: red;
      font-size: 20px;
    }
    (a) padding (b) center (c) .note (d) #top
  16. 16.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 220px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  17. 17.🖌️ How big is the text, in px?
    h2 {
      color: black;
      text-align: right;
      background-color: blue;
      font-size: 40px;
    }
  18. 18.🌈 Which colour of light is strongest in rgb(126, 100, 200)? (a) blue (b) red (c) green
  19. 19.✍️ Which sign ends each CSS declaration? (a) , (b) : (c) . (d) ;
  20. 20.🎯 Which element does the selector div style? (a) <div class="menu"> (b) <span> (c) <h1 id="logo"> (d) <p class="menu">
  21. 21.🎯 Which element does the selector .note style? (a) <li id="note"> (b) <li class="note"> (c) <div class="red"> (d) <li class="big">
  22. 22.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 16px;
      }
    }
    (a) Yes (b) No
  23. 23.🖌️ What colour are the letters?
    li {
      font-size: 12px;
      text-align: left;
      color: yellow;
      background-color: purple;
    }
    (a) purple (b) yellow (c) black
  24. 24.📱 Which tag helps phones show a page at the right size? (a) the br tag (b) the hr tag (c) the title tag (d) the viewport meta tag
  25. 25.🖌️ What colour is behind the letters?
    li {
      background-color: black;
      font-size: 12px;
      color: yellow;
      text-align: center;
    }
    (a) black (b) white (c) yellow
  26. 26.🌈 Which hex code is bright green? (a) #0000ff (b) #ffffff (c) #ff0000 (d) #00ff00
  27. 27.🎯 Which element does the selector #intro style? (a) <div class="big"> (b) <li id="main"> (c) <li class="intro"> (d) <li id="intro">
  28. 28.✍️ What is the selector in this CSS rule?
    #top {
      border: 2px solid;
      text-align: center;
      background-color: yellow;
    }
    (a) center (b) li (c) border (d) #top
  29. 29.✍️ Which property is set to 20px in this rule?
    li {
      font-weight: bold;
      color: red;
      font-size: 20px;
    }
    (a) background-color (b) 20px (c) font-size (d) text-align
  30. 30.Which of these does JavaScript do? (a) checks a quiz answer (b) sets colours and fonts (c) makes a form box (d) adds space around boxes
  31. 31.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 50px;
      padding: 5px;
      border: 3px solid black;
      margin: 0px;
    }
  32. 32.What does font-size do? (a) makes letters bigger (b) makes the text bold (c) colours behind the text (d) centres a heading
  33. 33.🔍 Which is the odd one out? (a) counts down a timer (b) sets colours and fonts (c) changes the page live (d) reacts to a button click
  34. 34.⚖️ What colour is the text of this element?
    <h1 class="note" id="logo">Hi</h1>
    CSS:
    #logo { color: blue; }
    #logo { color: black; }
    (a) blue (b) red (c) white (d) black
  35. 35.✍️ CSS declarations go inside which brackets? (a) < > (b) [ ] (c) { } (d) ( )
  36. 36.🎯 What kind of selector is .menu? (a) an id selector (b) an element selector (c) a class selector
  37. 37.🖌️ What colour is behind the letters?
    h2 {
      background-color: purple;
      text-align: center;
      font-size: 36px;
      color: yellow;
    }
    (a) purple (b) yellow (c) black
  38. 38.✍️ What is the selector in this CSS rule?
    .box {
      margin: 10px;
      padding: 8px;
    }
    (a) h2 (b) .box (c) margin (d) 8px
  39. 39.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 18px;
      }
    }
  40. 40.⚖️ Which selector is the weakest? (a) an element selector (b) a class selector (c) an id selector

Answer key

  1. red
  2. 40
  3. True
  4. makes headings and lists
  5. <link>
  6. a class selector
  7. on the right
  8. #
  9. bright green
  10. 182
  11. many pages
  12. 20
  13. 182
  14. colours behind the text
  15. .note
  16. 20
  17. 40
  18. blue
  19. ;
  20. <div class="menu">
  21. <li class="note">
  22. Yes
  23. yellow
  24. the viewport meta tag
  25. black
  26. #00ff00
  27. <li id="intro">
  28. #top
  29. font-size
  30. checks a quiz answer
  31. 66
  32. makes letters bigger
  33. sets colours and fonts
  34. black
  35. { }
  36. a class selector
  37. purple
  38. .box
  39. 18
  40. an element selector

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