← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 670 · 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?
    p {
      background-color: yellow;
      text-align: center;
      color: purple;
      font-size: 32px;
    }
    (a) in the middle (b) on the left (c) on the right
  2. 2.Which of these does HTML do? (a) sets colours and fonts (b) reacts to a button click (c) adds space around boxes (d) makes a form box
  3. 3.⚖️ What colour is the text of this element?
    <h2 class="menu" id="top">Hi</h2>
    CSS:
    .menu { color: black; }
    #top { color: green; }
    (a) green (b) orange (c) purple (d) black
  4. 4.✍️ Which property is set to 20px in this rule?
    h2 {
      margin: 10px;
      font-size: 20px;
      font-weight: bold;
    }
    (a) 20px (b) background-color (c) font-size (d) text-align
  5. 5.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 6px;
      }
    }
  6. 6.✍️ What is the selector in this CSS rule?
    body {
      border: 2px solid;
      width: 300px;
    }
    (a) .box (b) body (c) border (d) 300px
  7. 7.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 200px;
      justify-content: flex-end;
    }
    Inside are 3 boxes, each 50px wide (no margins).
  8. 8.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 50px;
      padding: 10px;
      border: 1px solid black;
      margin: 20px;
    }
  9. 9.📦 In the box model, which part is the text or picture? (a) border (b) content (c) margin (d) padding
  10. 10.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 28px;
      }
    }
  11. 11.Which of these does CSS do? (a) gives the page structure (b) makes a link (c) reacts to a button click (d) lays out the page
  12. 12.🖌️ Where does the text sit on its line?
    h1 {
      text-align: center;
      background-color: black;
      font-size: 36px;
      color: orange;
    }
    (a) on the right (b) in the middle (c) on the left
  13. 13.📱 The screen is 1366px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 14px;
      }
    }
    (a) Yes (b) No
  14. 14.🌈 In #150000 the red part is the hex number 15. What is it as a normal number?
  15. 15.⚖️ What colour is the text of this element?
    <h1 class="box" id="logo">Hi</h1>
    CSS:
    #logo { color: orange; }
    h1 { color: black; }
    (a) black (b) orange (c) yellow (d) purple
  16. 16.⚖️ What colour is the text of this element?
    <p class="box" id="logo">Hi</p>
    CSS:
    #logo { color: yellow; }
    #logo { color: white; }
    (a) red (b) white (c) yellow (d) blue
  17. 17.What does font-weight do? (a) centres a heading (b) makes letters bigger (c) makes the text bold (d) picks the font style
  18. 18.🖌️ What colour is behind the letters?
    h2 {
      color: green;
      text-align: center;
      background-color: blue;
      font-size: 40px;
    }
    (a) blue (b) black (c) green
  19. 19.🎯 Which sign starts an id selector? (a) . (b) & (c) # (d) @
  20. 20.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 14px;
      }
    }
  21. 21.✍️ Which sign ends each CSS declaration? (a) . (b) ; (c) : (d) ,
  22. 22.True or false: JavaScript lays out the page. (a) True (b) False
  23. 23.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) exactly 100px (c) 800px or wider (d) turned off
  24. 24.🎯 Which element does the selector .big style? (a) <p class="box"> (b) <span class="big"> (c) <span id="big"> (d) <span class="red">
  25. 25.🌈 Which hex code is red? (a) #00ff00 (b) #ff0000 (c) #ffff00 (d) #00ffff
  26. 26.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 140px;
      padding: 20px;
      border: 4px solid black;
      margin: 5px;
    }
  27. 27.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) neither (c) the later one (d) the first one
  28. 28.🌈 Which colour is rgb(0, 255, 0)? (a) blue (b) yellow (c) bright green (d) red
  29. 29.🎯 Can many elements share the same class? (a) No (b) Yes
  30. 30.⚖️ Which selector is the weakest? (a) an element selector (b) an id selector (c) a class selector
  31. 31.🖌️ Where does the text sit on its line?
    h1 {
      color: yellow;
      background-color: red;
      font-size: 16px;
      text-align: left;
    }
    (a) in the middle (b) on the right (c) on the left
  32. 32.✍️ CSS declarations go inside which brackets? (a) < > (b) ( ) (c) [ ] (d) { }
  33. 33.🌈 In #rrggbb, which colour do the last two digits give? (a) blue (b) green (c) white (d) red
  34. 34.True or false: li is an id selector. (a) True (b) False
  35. 35.🌈 Which hex code is blue? (a) #ffffff (b) #00ffff (c) #0000ff (d) #ffff00
  36. 36.🔍 Which is the odd one out? (a) rounds box corners (b) adds space around boxes (c) makes a link (d) sets colours and fonts
  37. 37.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 190px;
      padding: 30px;
      border: 1px solid black;
      margin: 10px;
    }
  38. 38.🖌️ Where does the text sit on its line?
    li {
      color: red;
      background-color: blue;
      text-align: center;
      font-size: 28px;
    }
    (a) on the right (b) in the middle (c) on the left
  39. 39.📱 What does a media query check? (a) the screen width (b) the battery level (c) the time of day (d) the page title
  40. 40.🌈 Hex digits go 0 to 9, then A to which letter? (a) Z (b) J (c) F (d) G

Answer key

  1. in the middle
  2. makes a form box
  3. green
  4. font-size
  5. 12
  6. body
  7. 50
  8. 112
  9. content
  10. 20
  11. lays out the page
  12. in the middle
  13. Yes
  14. 21
  15. orange
  16. white
  17. makes the text bold
  18. blue
  19. #
  20. 14
  21. ;
  22. False
  23. 800px or wider
  24. <span class="big">
  25. #ff0000
  26. 198
  27. the later one
  28. bright green
  29. Yes
  30. an element selector
  31. on the left
  32. { }
  33. blue
  34. False
  35. #0000ff
  36. makes a link
  37. 252
  38. in the middle
  39. the screen width
  40. F

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