← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 983 · 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.🧩 Which language sets colours and fonts? (a) JavaScript (b) HTML (c) CSS
  2. 2.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 28px;
      }
    }
  3. 3.🔍 Which is the odd one out? (a) reacts to a button click (b) changes the page live (c) makes a form box (d) counts down a timer
  4. 4.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 14px;
      }
    }
    (a) No (b) Yes
  5. 5.🔍 Which is the odd one out? (a) makes headings and lists (b) gives the page structure (c) makes a link (d) changes the page live
  6. 6.🌈 Which colour is rgb(255, 255, 0)? (a) yellow (b) cyan (c) blue (d) magenta
  7. 7.⚖️ What colour is the text of this element?
    <h1 class="box" id="main">Hi</h1>
    CSS:
    h1 { color: orange; }
    .box { color: black; }
    (a) black (b) white (c) orange (d) red
  8. 8.✍️ Which sign goes between a property and its value? (a) ; (b) - (c) : (d) =
  9. 9.What does justify-content: flex-end do? (a) equal gaps, none at ends (b) puts boxes in the middle (c) packs boxes at the start (d) packs boxes at the end
  10. 10.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 50px;
      padding: 30px;
      border: 2px solid black;
      margin: 15px;
    }
  11. 11.✍️ What is the selector in this CSS rule?
    .box {
      padding: 8px;
      font-size: 20px;
      font-style: italic;
      background-color: yellow;
    }
    (a) padding (b) 20px (c) h2 (d) .box
  12. 12.✍️ Which property is set to italic in this rule?
    p {
      font-size: 20px;
      background-color: yellow;
      margin: 10px;
      font-style: italic;
    }
    (a) italic (b) font-size (c) font-style (d) color
  13. 13.✍️ What is the selector in this CSS rule?
    h1 {
      width: 300px;
      color: red;
      font-weight: bold;
    }
    (a) p (b) red (c) h1 (d) width
  14. 14.🧩 Which language reacts to a button click? (a) HTML (b) CSS (c) JavaScript
  15. 15.🎯 What kind of selector is .star? (a) an element selector (b) a class selector (c) an id selector
  16. 16.✍️ How many declarations (property: value pairs) are in this rule?
    body {
      margin: 10px;
    }
  17. 17.⚖️ What colour is the text of this element?
    <h2 class="note" id="end">Hi</h2>
    CSS:
    #end { color: yellow; }
    h2 { color: red; }
    .note { color: orange; }
    (a) orange (b) purple (c) yellow (d) red
  18. 18.🎨 What does CSS stand for? (a) Computer Style Sheets (b) Cascading Style Sheets (c) Creative Sheet System (d) Colourful Site Styles
  19. 19.⚖️ Which selector is the weakest? (a) an id selector (b) an element selector (c) a class selector
  20. 20.✍️ What is the selector in this CSS rule?
    h2 {
      margin: 10px;
      background-color: yellow;
      color: red;
    }
    (a) yellow (b) margin (c) h1 (d) h2
  21. 21.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the later one (b) the shorter one (c) the first one (d) neither
  22. 22.✍️ What is the selector in this CSS rule?
    .box {
      font-weight: bold;
      margin: 10px;
      font-size: 20px;
      width: 300px;
    }
    (a) h2 (b) font-weight (c) 10px (d) .box
  23. 23.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 280px;
      justify-content: center;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  24. 24.Which of these does HTML do? (a) changes the page live (b) sets colours and fonts (c) checks a quiz answer (d) gives the page structure
  25. 25.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 420px;
      justify-content: center;
    }
    Inside are 4 boxes, each 80px wide (no margins).
  26. 26.✍️ What value is given to color in this rule?
    body {
      margin: 10px;
      color: red;
      text-align: center;
      width: 300px;
    }
    (a) center (b) color (c) red (d) 20px
  27. 27.✍️ How does a CSS comment start? (a) // (b) /* (c) # (d) <!--
  28. 28.🌈 Which colour is #ffffff? (a) white (b) black (c) magenta (d) yellow
  29. 29.📱 Responsive design means a page ___. (a) has no pictures (b) is only for laptops (c) fits every screen (d) never changes
  30. 30.⚖️ What colour is the text of this element?
    <h2 class="star" id="main">Hi</h2>
    CSS:
    h2 { color: blue; }
    #main { color: black; }
    .star { color: purple; }
    (a) green (b) purple (c) black (d) blue
  31. 31.✍️ What is the selector in this CSS rule?
    .note {
      text-align: center;
      margin: 10px;
      background-color: yellow;
    }
    (a) #top (b) text-align (c) 10px (d) .note
  32. 32.✍️ What is the selector in this CSS rule?
    .box {
      background-color: yellow;
      width: 300px;
    }
    (a) .box (b) h2 (c) background-color (d) 300px
  33. 33.Which of these does CSS do? (a) reacts to a button click (b) makes headings and lists (c) makes a link (d) changes the text size
  34. 34.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 340px;
      justify-content: space-between;
    }
    Inside are 3 boxes, each 100px wide (no margins).
  35. 35.Which of these does HTML do? (a) reacts to a button click (b) lays out the page (c) puts a picture on a page (d) changes the text size
  36. 36.⚖️ What colour is the text of this element?
    <p class="red" id="intro">Hi</p>
    CSS:
    .red { color: blue; }
    p { color: yellow; }
    (a) yellow (b) blue (c) orange (d) red
  37. 37.🖌️ What colour is behind the letters?
    li {
      text-align: right;
      color: green;
      background-color: black;
      font-size: 28px;
    }
    (a) blue (b) black (c) green
  38. 38.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 210px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  39. 39.🖌️ What colour are the letters?
    p {
      background-color: blue;
      text-align: right;
      font-size: 32px;
      color: yellow;
    }
    (a) blue (b) red (c) yellow
  40. 40.True or false: .menu is an id selector. (a) False (b) True

Answer key

  1. CSS
  2. 28
  3. makes a form box
  4. No
  5. changes the page live
  6. yellow
  7. black
  8. :
  9. packs boxes at the end
  10. 144
  11. .box
  12. font-style
  13. h1
  14. JavaScript
  15. a class selector
  16. 1
  17. yellow
  18. Cascading Style Sheets
  19. an element selector
  20. h2
  21. the later one
  22. .box
  23. 80
  24. gives the page structure
  25. 50
  26. red
  27. /*
  28. white
  29. fits every screen
  30. black
  31. .note
  32. .box
  33. changes the text size
  34. 20
  35. puts a picture on a page
  36. blue
  37. black
  38. 10
  39. yellow
  40. False

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