← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 784 · 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 colour is the text of this element?
    <h1 class="note" id="top">Hi</h1>
    CSS:
    #top { color: red; }
    .note { color: black; }
    h1 { color: yellow; }
    (a) black (b) red (c) yellow (d) orange
  2. 2.✍️ What value is given to margin in this rule?
    h1 {
      padding: 8px;
      margin: 10px;
      font-size: 20px;
    }
    (a) bold (b) margin (c) 8px (d) 10px
  3. 3.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 50px;
      padding: 20px;
      border: 4px solid black;
      margin: 5px;
    }
  4. 4.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 32px;
      }
    }
  5. 5.🌈 Which colour is rgb(0, 0, 255)? (a) red (b) bright green (c) blue (d) cyan
  6. 6.🖌️ Where does the text sit on its line?
    li {
      font-size: 32px;
      text-align: center;
      color: blue;
      background-color: red;
    }
    (a) in the middle (b) on the right (c) on the left
  7. 7.What does text-align do? (a) centres a heading (b) colours behind the text (c) picks the font style (d) makes the text bold
  8. 8.✍️ CSS declarations go inside which brackets? (a) { } (b) [ ] (c) < > (d) ( )
  9. 9.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 28px;
      }
    }
    (a) No (b) Yes
  10. 10.🧩 Which language counts down a timer? (a) HTML (b) CSS (c) JavaScript
  11. 11.📱 The screen is 1366px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 18px;
      }
    }
    (a) No (b) Yes
  12. 12.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 320px;
      justify-content: center;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  13. 13.🎨 What does CSS stand for? (a) Cascading Style Sheets (b) Creative Sheet System (c) Colourful Site Styles (d) Computer Style Sheets
  14. 14.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 16px;
      }
    }
    (a) No (b) Yes
  15. 15.📱 Responsive design means a page ___. (a) never changes (b) fits every screen (c) is only for laptops (d) has no pictures
  16. 16.🌈 Which colour is #00ff00? (a) bright green (b) yellow (c) blue (d) cyan
  17. 17.🌈 Which hex code is red? (a) #ffff00 (b) #0000ff (c) #00ff00 (d) #ff0000
  18. 18.🎨 One CSS file can style how many pages? (a) only one image (b) many pages (c) only one word (d) no pages
  19. 19.⚖️ Which selector is the strongest? (a) a class selector (b) an element selector (c) an id selector
  20. 20.🌈 Which colour is #000000? (a) bright green (b) cyan (c) blue (d) black
  21. 21.True or false: body is a class selector. (a) False (b) True
  22. 22.✍️ In color: blue; which part is the value? (a) color (b) ; (c) blue (d) :
  23. 23.🧩 Which language reacts to a button click? (a) HTML (b) CSS (c) JavaScript
  24. 24.🌈 In #960000 the red part is the hex number 96. What is it as a normal number?
  25. 25.💪 Which justify-content value equal gaps, none at ends? (a) flex-end (b) center (c) space-between (d) flex-start
  26. 26.🌈 What is the biggest number one colour can have in rgb()? (a) 1000 (b) 99 (c) 255 (d) 100
  27. 27.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 200px;
      justify-content: center;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  28. 28.What does font-weight do? (a) makes letters bigger (b) colours behind the text (c) makes the text bold (d) sets the letter colour
  29. 29.True or false: JavaScript sets colours and fonts. (a) True (b) False
  30. 30.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 32px;
      }
    }
  31. 31.🖌️ Which CSS property picks the font style? (a) color (b) font-weight (c) background-color (d) font-family
  32. 32.🖌️ Which CSS property colours behind the text? (a) background-color (b) font-family (c) font-weight (d) color
  33. 33.✍️ How many declarations (property: value pairs) are in this rule?
    #top {
      width: 300px;
      margin: 10px;
      font-style: italic;
    }
  34. 34.🎯 What kind of selector is .menu? (a) an id selector (b) an element selector (c) a class selector
  35. 35.✍️ Which sign goes between a property and its value? (a) = (b) ; (c) - (d) :
  36. 36.🌈 Which colour is rgb(0, 255, 0)? (a) yellow (b) black (c) bright green (d) blue
  37. 37.🖌️ What colour is behind the letters?
    li {
      text-align: left;
      background-color: red;
      font-size: 40px;
      color: orange;
    }
    (a) red (b) white (c) orange
  38. 38.Which of these does JavaScript do? (a) changes the text size (b) makes a link (c) sets colours and fonts (d) shows a pop-up message
  39. 39.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 300px;
      padding: 30px;
      border: 3px solid black;
      margin: 0px;
    }
  40. 40.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 130px;
      padding: 10px;
      border: 3px solid black;
      margin: 15px;
    }

Answer key

  1. red
  2. 10px
  3. 108
  4. 24
  5. blue
  6. in the middle
  7. centres a heading
  8. { }
  9. No
  10. JavaScript
  11. Yes
  12. 60
  13. Cascading Style Sheets
  14. Yes
  15. fits every screen
  16. bright green
  17. #ff0000
  18. many pages
  19. an id selector
  20. black
  21. False
  22. blue
  23. JavaScript
  24. 150
  25. space-between
  26. 255
  27. 60
  28. makes the text bold
  29. False
  30. 32
  31. font-family
  32. background-color
  33. 3
  34. a class selector
  35. :
  36. bright green
  37. red
  38. shows a pop-up message
  39. 366
  40. 156

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