← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 166 · 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 color: blue; which part is the value? (a) : (b) blue (c) color (d) ;
  2. 2.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 120px;
      padding: 10px;
      border: 3px solid black;
      margin: 20px;
    }
  3. 3.✍️ How does a CSS comment start? (a) /* (b) # (c) // (d) <!--
  4. 4.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 340px;
      justify-content: center;
    }
    Inside are 4 boxes, each 80px wide (no margins).
  5. 5.🎨 Which tag connects an outside CSS file? (a) <link> (b) <a> (c) <css> (d) <img>
  6. 6.💪 Which flexbox property turns on flexbox? (a) flex-direction (b) display: flex (c) justify-content (d) gap
  7. 7.🔍 Which is the odd one out? (a) puts a picture on a page (b) makes a link (c) shows a pop-up message (d) makes a form box
  8. 8.🎯 Which sign starts a class selector? (a) & (b) . (c) @ (d) #
  9. 9.⚖️ What colour is the text of this element?
    <h1 class="big" id="hero">Hi</h1>
    CSS:
    h1 { color: white; }
    h1 { color: yellow; }
    (a) red (b) white (c) yellow (d) orange
  10. 10.True or false: .star is a class selector. (a) True (b) False
  11. 11.🌈 Which colour is rgb(0, 255, 255)? (a) white (b) red (c) cyan (d) bright green
  12. 12.⚖️ Which selector is the strongest? (a) a class selector (b) an id selector (c) an element selector
  13. 13.Which of these does JavaScript do? (a) gives the page structure (b) makes headings and lists (c) makes a link (d) checks a quiz answer
  14. 14.Which of these does CSS do? (a) checks a quiz answer (b) makes a link (c) sets colours and fonts (d) gives the page structure
  15. 15.🎯 Which CSS selector matches this element?
    <span class="box" id="intro">Hello</span>
    (a) #intro (b) p (c) #main (d) .intro
  16. 16.📱 Which tag helps phones show a page at the right size? (a) the viewport meta tag (b) the br tag (c) the title tag (d) the hr tag
  17. 17.🎨 What does CSS stand for? (a) Computer Style Sheets (b) Colourful Site Styles (c) Cascading Style Sheets (d) Creative Sheet System
  18. 18.🌈 Which colour is #00ff00? (a) blue (b) bright green (c) white (d) magenta
  19. 19.What does background-color do? (a) makes letters bigger (b) colours behind the text (c) picks the font style (d) sets the letter colour
  20. 20.⚖️ What colour is the text of this element?
    <h2 class="big" id="top">Hi</h2>
    CSS:
    .big { color: orange; }
    .big { color: purple; }
    (a) green (b) orange (c) yellow (d) purple
  21. 21.True or false: p is an element selector. (a) True (b) False
  22. 22.🖌️ Which CSS property makes letters bigger? (a) background-color (b) text-align (c) font-weight (d) font-size
  23. 23.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 28px;
      }
    }
  24. 24.✍️ CSS declarations go inside which brackets? (a) [ ] (b) < > (c) { } (d) ( )
  25. 25.📦 In the box model, which part is space outside the border? (a) margin (b) content (c) border (d) padding
  26. 26.🎯 Which element does the selector #hero style? (a) <li id="top"> (b) <div class="red"> (c) <li class="hero"> (d) <li id="hero">
  27. 27.🧩 Which language puts a picture on a page? (a) HTML (b) JavaScript (c) CSS
  28. 28.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 250px;
      padding: 10px;
      border: 4px solid black;
      margin: 0px;
    }
  29. 29.What does justify-content: flex-start do? (a) packs boxes at the start (b) puts boxes in the middle (c) equal gaps, none at ends (d) packs boxes at the end
  30. 30.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 22px;
      }
    }
  31. 31.✍️ What value is given to color in this rule?
    .note {
      width: 300px;
      text-align: center;
      color: red;
    }
    (a) red (b) color (c) center (d) 20px
  32. 32.🌈 Which colour of light is strongest in rgb(106, 178, 84)? (a) blue (b) green (c) red
  33. 33.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 14px;
      }
    }
  34. 34.💪 Which justify-content value equal gaps, none at ends? (a) space-between (b) center (c) flex-end (d) flex-start
  35. 35.✍️ What value is given to font-weight in this rule?
    .note {
      font-weight: bold;
      color: red;
    }
    (a) bold (b) 2px solid (c) font-weight (d) 300px
  36. 36.Which of these does HTML do? (a) makes headings and lists (b) changes the text size (c) adds space around boxes (d) counts down a timer
  37. 37.True or false: h1 is an element selector. (a) True (b) False
  38. 38.True or false: .card is an id selector. (a) False (b) True
  39. 39.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      color: red;
    }
  40. 40.⚖️ What colour is the text of this element?
    <h1 class="note" id="logo">Hi</h1>
    CSS:
    .note { color: white; }
    #logo { color: green; }
    h1 { color: orange; }
    (a) black (b) white (c) green (d) orange

Answer key

  1. blue
  2. 186
  3. /*
  4. 10
  5. <link>
  6. display: flex
  7. shows a pop-up message
  8. .
  9. yellow
  10. True
  11. cyan
  12. an id selector
  13. checks a quiz answer
  14. sets colours and fonts
  15. #intro
  16. the viewport meta tag
  17. Cascading Style Sheets
  18. bright green
  19. colours behind the text
  20. purple
  21. True
  22. font-size
  23. 24
  24. { }
  25. margin
  26. <li id="hero">
  27. HTML
  28. 278
  29. packs boxes at the start
  30. 20
  31. red
  32. green
  33. 12
  34. space-between
  35. bold
  36. makes headings and lists
  37. True
  38. False
  39. 1
  40. green

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