← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 801 · 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.🌈 In #004600 the green part is the hex number 46. What is it as a normal number?
  2. 2.✍️ What is the selector in this CSS rule?
    h1 {
      margin: 10px;
      background-color: yellow;
      padding: 8px;
      text-align: center;
    }
    (a) margin (b) h1 (c) p (d) yellow
  3. 3.🎨 Which tag connects an outside CSS file? (a) <a> (b) <css> (c) <img> (d) <link>
  4. 4.What does justify-content: center do? (a) puts boxes in the middle (b) packs boxes at the start (c) packs boxes at the end (d) equal gaps, none at ends
  5. 5.🖌️ What colour is behind the letters?
    li {
      background-color: orange;
      font-size: 12px;
      color: green;
      text-align: center;
    }
    (a) orange (b) green (c) purple
  6. 6.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 20px;
      }
    }
    (a) No (b) Yes
  7. 7.Which of these does CSS do? (a) makes headings and lists (b) lays out the page (c) checks a quiz answer (d) gives the page structure
  8. 8.True or false: JavaScript checks a quiz answer. (a) True (b) False
  9. 9.⚖️ What colour is the text of this element?
    <h1 class="star" id="intro">Hi</h1>
    CSS:
    .star { color: blue; }
    .star { color: yellow; }
    (a) yellow (b) red (c) blue (d) orange
  10. 10.True or false: JavaScript adds space around boxes. (a) True (b) False
  11. 11.✍️ How does a CSS comment start? (a) // (b) <!-- (c) # (d) /*
  12. 12.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 22px;
      }
    }
    (a) No (b) Yes
  13. 13.🌈 Which colour of light is strongest in rgb(182, 61, 34)? (a) green (b) red (c) blue
  14. 14.📱 Responsive design means a page ___. (a) has no pictures (b) never changes (c) is only for laptops (d) fits every screen
  15. 15.🎯 Which element does the selector h2 style? (a) <h2 class="menu"> (b) <li> (c) <span id="top"> (d) <div class="menu">
  16. 16.🧩 Which language lays out the page? (a) HTML (b) CSS (c) JavaScript
  17. 17.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 26px;
      }
    }
  18. 18.🧩 Which language sets colours and fonts? (a) JavaScript (b) CSS (c) HTML
  19. 19.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 18px;
      }
    }
    (a) Yes (b) No
  20. 20.What does color do? (a) picks the font style (b) centres a heading (c) colours behind the text (d) sets the letter colour
  21. 21.✍️ How many declarations (property: value pairs) are in this rule?
    body {
      width: 300px;
      text-align: center;
      border: 2px solid;
      padding: 8px;
    }
  22. 22.⚖️ Two rules with the same selector set a colour. Which one wins? (a) neither (b) the first one (c) the shorter one (d) the later one
  23. 23.📦 In the box model, which part is space outside the border? (a) padding (b) margin (c) content (d) border
  24. 24.🖌️ What colour are the letters?
    h1 {
      color: green;
      text-align: center;
      background-color: yellow;
      font-size: 16px;
    }
    (a) green (b) red (c) yellow
  25. 25.🎯 What kind of selector is .note? (a) a class selector (b) an element selector (c) an id selector
  26. 26.💪 Which justify-content value packs boxes at the end? (a) flex-start (b) space-between (c) center (d) flex-end
  27. 27.✍️ Which property is set to 20px in this rule?
    h2 {
      font-size: 20px;
      border: 2px solid;
      background-color: yellow;
    }
    (a) text-align (b) 20px (c) font-size (d) background-color
  28. 28.📦 In the box model, which part is the gap round content? (a) content (b) margin (c) border (d) padding
  29. 29.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 270px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  30. 30.🌈 Which hex code is bright green? (a) #ff00ff (b) #00ff00 (c) #00ffff (d) #0000ff
  31. 31.🌈 In #6b0000 the red part is the hex number 6b. What is it as a normal number?
  32. 32.🎯 How many elements on a page should have the same id? (a) 5 (b) 1 (c) any number (d) 2
  33. 33.✍️ In color: blue; which part is the property? (a) : (b) color (c) blue (d) ;
  34. 34.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 300px;
      justify-content: center;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  35. 35.True or false: .big is an id selector. (a) False (b) True
  36. 36.✍️ Which property is set to center in this rule?
    li {
      text-align: center;
      color: red;
      width: 300px;
    }
    (a) margin (b) center (c) background-color (d) text-align
  37. 37.✍️ What value is given to color in this rule?
    body {
      border: 2px solid;
      padding: 8px;
      color: red;
      width: 300px;
    }
    (a) color (b) center (c) red (d) 20px
  38. 38.⚖️ What colour is the text of this element?
    <h1 class="big" id="hero">Hi</h1>
    CSS:
    h1 { color: green; }
    .big { color: blue; }
    #hero { color: red; }
    (a) green (b) red (c) blue (d) black
  39. 39.🎨 What does CSS stand for? (a) Creative Sheet System (b) Cascading Style Sheets (c) Colourful Site Styles (d) Computer Style Sheets
  40. 40.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 18px;
      }
    }

Answer key

  1. 70
  2. h1
  3. <link>
  4. puts boxes in the middle
  5. orange
  6. Yes
  7. lays out the page
  8. True
  9. yellow
  10. False
  11. /*
  12. Yes
  13. red
  14. fits every screen
  15. <h2 class="menu">
  16. CSS
  17. 24
  18. CSS
  19. Yes
  20. sets the letter colour
  21. 4
  22. the later one
  23. margin
  24. green
  25. a class selector
  26. flex-end
  27. font-size
  28. padding
  29. 70
  30. #00ff00
  31. 107
  32. 1
  33. color
  34. 50
  35. False
  36. text-align
  37. red
  38. red
  39. Cascading Style Sheets
  40. 16

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