← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 714 · 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.🎯 What kind of selector is #logo? (a) an element selector (b) a class selector (c) an id selector
  2. 2.🎯 Which element does the selector .menu style? (a) <h1 id="menu"> (b) <h1 class="menu"> (c) <h1 class="note"> (d) <h2 class="big">
  3. 3.🎯 Can many elements share the same class? (a) Yes (b) No
  4. 4.🖌️ How big is the text, in px?
    p {
      color: green;
      text-align: right;
      font-size: 24px;
      background-color: yellow;
    }
  5. 5.🌈 Which colour of light is strongest in rgb(52, 161, 92)? (a) red (b) green (c) blue
  6. 6.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 420px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 100px wide (no margins).
  7. 7.🌈 Which colour is rgb(255, 255, 255)? (a) white (b) black (c) yellow (d) red
  8. 8.🌈 Which colour is rgb(0, 255, 0)? (a) blue (b) bright green (c) yellow (d) cyan
  9. 9.🔍 Which is the odd one out? (a) changes the page live (b) makes headings and lists (c) shows a pop-up message (d) reacts to a button click
  10. 10.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 28px;
      }
    }
  11. 11.What does text-align do? (a) makes letters bigger (b) colours behind the text (c) sets the letter colour (d) centres a heading
  12. 12.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 290px;
      padding: 10px;
      border: 3px solid black;
      margin: 20px;
    }
  13. 13.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 360px;
      justify-content: center;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  14. 14.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 18px;
      }
    }
    (a) No (b) Yes
  15. 15.🔍 Which is the odd one out? (a) gives the page structure (b) lays out the page (c) changes the text size (d) adds space around boxes
  16. 16.🎨 Which attribute adds CSS inside one tag? (a) style (b) alt (c) href (d) src
  17. 17.🎨 Which tag holds CSS inside the head? (a) <script> (b) <body> (c) <css> (d) <style>
  18. 18.🎨 Which tag connects an outside CSS file? (a) <css> (b) <link> (c) <img> (d) <a>
  19. 19.⚖️ What colour is the text of this element?
    <h2 class="star" id="end">Hi</h2>
    CSS:
    h2 { color: red; }
    .star { color: white; }
    #end { color: purple; }
    (a) red (b) green (c) purple (d) white
  20. 20.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 22px;
      }
    }
  21. 21.💪 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).
  22. 22.True or false: p is an element selector. (a) True (b) False
  23. 23.Which of these does CSS do? (a) changes the page live (b) counts down a timer (c) gives the page structure (d) sets colours and fonts
  24. 24.🖌️ What colour is behind the letters?
    p {
      text-align: center;
      color: blue;
      font-size: 20px;
      background-color: green;
    }
    (a) black (b) green (c) blue
  25. 25.🌈 Which hex code is blue? (a) #00ff00 (b) #ffffff (c) #000000 (d) #0000ff
  26. 26.True or false: the content is the text or picture. (a) False (b) True
  27. 27.📱 Which tag helps phones show a page at the right size? (a) the br tag (b) the viewport meta tag (c) the title tag (d) the hr tag
  28. 28.✍️ Which property is set to bold in this rule?
    .note {
      font-weight: bold;
      font-style: italic;
    }
    (a) width (b) bold (c) border (d) font-weight
  29. 29.🔍 Which is the odd one out? (a) makes headings and lists (b) reacts to a button click (c) makes a link (d) gives the page structure
  30. 30.🌈 Which hex code is yellow? (a) #ffffff (b) #ff00ff (c) #ff0000 (d) #ffff00
  31. 31.⚖️ What colour is the text of this element?
    <h2 class="note" id="logo">Hi</h2>
    CSS:
    h2 { color: black; }
    #logo { color: white; }
    .note { color: purple; }
    (a) green (b) purple (c) white (d) black
  32. 32.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 18px;
      }
    }
  33. 33.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 580px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 100px wide (no margins).
  34. 34.Which of these does HTML do? (a) makes a form box (b) checks a quiz answer (c) lays out the page (d) shows a pop-up message
  35. 35.What does font-family do? (a) sets the letter colour (b) colours behind the text (c) picks the font style (d) makes letters bigger
  36. 36.🖌️ Which CSS property sets the letter colour? (a) font-size (b) color (c) background-color (d) font-family
  37. 37.🎯 What kind of selector is li? (a) a class selector (b) an id selector (c) an element selector
  38. 38.🌈 In #000030 the blue part is the hex number 30. What is it as a normal number?
  39. 39.⚖️ Which selector is the weakest? (a) an id selector (b) an element selector (c) a class selector
  40. 40.📱 What does a media query check? (a) the screen width (b) the time of day (c) the battery level (d) the page title

Answer key

  1. an id selector
  2. <h1 class="menu">
  3. Yes
  4. 24
  5. green
  6. 20
  7. white
  8. bright green
  9. makes headings and lists
  10. 20
  11. centres a heading
  12. 316
  13. 80
  14. No
  15. gives the page structure
  16. style
  17. <style>
  18. <link>
  19. purple
  20. 16
  21. 20
  22. True
  23. sets colours and fonts
  24. green
  25. #0000ff
  26. True
  27. the viewport meta tag
  28. font-weight
  29. reacts to a button click
  30. #ffff00
  31. white
  32. 16
  33. 60
  34. makes a form box
  35. picks the font style
  36. color
  37. an element selector
  38. 48
  39. an element selector
  40. the screen width

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