← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 260 · 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 element does the selector div style? (a) <p class="big"> (b) <h1 id="end"> (c) <span> (d) <div class="big">
  2. 2.✍️ Which property is set to center in this rule?
    li {
      text-align: center;
      font-style: italic;
      color: red;
    }
    (a) center (b) margin (c) background-color (d) text-align
  3. 3.🔍 Which is the odd one out? (a) makes a form box (b) gives the page structure (c) changes the text size (d) makes a link
  4. 4.True or false: .menu is a class selector. (a) True (b) False
  5. 5.✍️ Which property is set to yellow in this rule?
    h2 {
      text-align: center;
      background-color: yellow;
      color: red;
    }
    (a) background-color (b) margin (c) yellow (d) padding
  6. 6.🎨 Which tag connects an outside CSS file? (a) <a> (b) <css> (c) <link> (d) <img>
  7. 7.Which of these does CSS do? (a) checks a quiz answer (b) sets colours and fonts (c) reacts to a button click (d) makes a link
  8. 8.What does text-align do? (a) makes letters bigger (b) centres a heading (c) colours behind the text (d) picks the font style
  9. 9.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 290px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 60px wide (no margins).
  10. 10.🧩 Which language lays out the page? (a) CSS (b) JavaScript (c) HTML
  11. 11.✍️ What value is given to font-weight in this rule?
    body {
      border: 2px solid;
      font-weight: bold;
      text-align: center;
      font-size: 20px;
    }
    (a) bold (b) 2px solid (c) 300px (d) font-weight
  12. 12.✍️ Which property is set to italic in this rule?
    h1 {
      font-style: italic;
      color: red;
    }
    (a) italic (b) color (c) font-style (d) font-size
  13. 13.True or false: img is an element selector. (a) True (b) False
  14. 14.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      text-align: center;
    }
  15. 15.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      background-color: yellow;
    }
  16. 16.What does font-size do? (a) centres a heading (b) colours behind the text (c) sets the letter colour (d) makes letters bigger
  17. 17.🔍 Which is the odd one out? (a) lays out the page (b) makes a form box (c) puts a picture on a page (d) makes a link
  18. 18.⚖️ What colour is the text of this element?
    <h1 class="menu" id="top">Hi</h1>
    CSS:
    h1 { color: green; }
    h1 { color: red; }
    (a) red (b) black (c) green (d) purple
  19. 19.🖌️ Which CSS property makes letters bigger? (a) font-size (b) background-color (c) color (d) font-weight
  20. 20.🖌️ What colour are the letters?
    li {
      color: black;
      font-size: 24px;
      text-align: center;
      background-color: green;
    }
    (a) orange (b) black (c) green
  21. 21.🎨 What does CSS stand for? (a) Colourful Site Styles (b) Creative Sheet System (c) Cascading Style Sheets (d) Computer Style Sheets
  22. 22.✍️ CSS declarations go inside which brackets? (a) { } (b) ( ) (c) [ ] (d) < >
  23. 23.⚖️ What colour is the text of this element?
    <h1 class="red" id="logo">Hi</h1>
    CSS:
    h1 { color: black; }
    h1 { color: blue; }
    (a) orange (b) blue (c) yellow (d) black
  24. 24.🌈 In #rrggbb, which colour do the first two digits give? (a) blue (b) black (c) red (d) green
  25. 25.🎯 Which element does the selector p style? (a) <li id="top"> (b) <h2 class="menu"> (c) <p class="menu"> (d) <h1>
  26. 26.📦 In the box model, which part is the gap round content? (a) border (b) content (c) margin (d) padding
  27. 27.True or false: CSS puts a picture on a page. (a) True (b) False
  28. 28.📦 In the box model, which part is the gap to other boxes? (a) content (b) margin (c) padding (d) border
  29. 29.True or false: CSS adds space around boxes. (a) False (b) True
  30. 30.True or false: li is an id selector. (a) True (b) False
  31. 31.✍️ What value is given to margin in this rule?
    body {
      border: 2px solid;
      margin: 10px;
      color: red;
      background-color: yellow;
    }
    (a) bold (b) 8px (c) 10px (d) margin
  32. 32.What does justify-content: space-between do? (a) packs boxes at the end (b) puts boxes in the middle (c) packs boxes at the start (d) equal gaps, none at ends
  33. 33.🎯 Which element does the selector li style? (a) <p id="hero"> (b) <li class="note"> (c) <div> (d) <span class="note">
  34. 34.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 24px;
      }
    }
  35. 35.🌈 Which colour is rgb(255, 0, 0)? (a) blue (b) bright green (c) red (d) black
  36. 36.⚖️ What colour is the text of this element?
    <p class="note" id="main">Hi</p>
    CSS:
    .note { color: yellow; }
    #main { color: orange; }
    (a) orange (b) blue (c) red (d) yellow
  37. 37.🖌️ What colour are the letters?
    li {
      background-color: green;
      font-size: 32px;
      text-align: left;
      color: purple;
    }
    (a) green (b) orange (c) purple
  38. 38.⚖️ What colour is the text of this element?
    <h2 class="red" id="hero">Hi</h2>
    CSS:
    #hero { color: red; }
    #hero { color: purple; }
    (a) orange (b) purple (c) blue (d) red
  39. 39.What does font-weight do? (a) makes letters bigger (b) sets the letter colour (c) makes the text bold (d) colours behind the text
  40. 40.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the later one (b) neither (c) the first one (d) the shorter one

Answer key

  1. <div class="big">
  2. text-align
  3. changes the text size
  4. True
  5. background-color
  6. <link>
  7. sets colours and fonts
  8. centres a heading
  9. 50
  10. CSS
  11. bold
  12. font-style
  13. True
  14. 1
  15. 1
  16. makes letters bigger
  17. lays out the page
  18. red
  19. font-size
  20. black
  21. Cascading Style Sheets
  22. { }
  23. blue
  24. red
  25. <p class="menu">
  26. padding
  27. False
  28. margin
  29. True
  30. False
  31. 10px
  32. equal gaps, none at ends
  33. <li class="note">
  34. 24
  35. red
  36. orange
  37. purple
  38. purple
  39. makes the text bold
  40. the later one

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