← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 870 · 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?
    <h2 class="note" id="main">Hi</h2>
    CSS:
    #main { color: green; }
    #main { color: white; }
    (a) white (b) green (c) orange (d) purple
  2. 2.🎯 Which element does the selector .red style? (a) <li class="star"> (b) <h2 id="red"> (c) <h2 class="box"> (d) <h2 class="red">
  3. 3.True or false: .card is an id selector. (a) True (b) False
  4. 4.✍️ In color: blue; which part is the value? (a) ; (b) : (c) blue (d) color
  5. 5.What does font-size do? (a) sets the letter colour (b) colours behind the text (c) picks the font style (d) makes letters bigger
  6. 6.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 110px;
      padding: 20px;
      border: 2px solid black;
      margin: 10px;
    }
  7. 7.📦 In the box model, which part is the line round the box? (a) padding (b) content (c) border (d) margin
  8. 8.🖌️ Which CSS property picks the font style? (a) font-size (b) font-family (c) background-color (d) font-weight
  9. 9.📱 min-width: 800px applies when the screen is ___. (a) exactly 100px (b) 800px or wider (c) 800px or narrower (d) turned off
  10. 10.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 110px;
      padding: 10px;
      border: 3px solid black;
      margin: 15px;
    }
  11. 11.🔍 Which is the odd one out? (a) puts a picture on a page (b) gives the page structure (c) makes a form box (d) sets colours and fonts
  12. 12.✍️ Which sign goes between a property and its value? (a) = (b) ; (c) : (d) -
  13. 13.📱 Which tag helps phones show a page at the right size? (a) the hr tag (b) the br tag (c) the title tag (d) the viewport meta tag
  14. 14.True or false: CSS changes the text size. (a) False (b) True
  15. 15.🧩 Which language makes a link? (a) JavaScript (b) CSS (c) HTML
  16. 16.🌈 What is the biggest number one colour can have in rgb()? (a) 99 (b) 100 (c) 255 (d) 1000
  17. 17.True or false: the border is a solid or dotted edge. (a) False (b) True
  18. 18.🌈 Which colour is #0000ff? (a) black (b) bright green (c) yellow (d) blue
  19. 19.🖌️ How big is the text, in px?
    h2 {
      font-size: 20px;
      text-align: center;
      color: green;
      background-color: orange;
    }
  20. 20.🎯 Which element does the selector #intro style? (a) <li id="intro"> (b) <li class="intro"> (c) <div class="big"> (d) <li id="main">
  21. 21.⚖️ What colour is the text of this element?
    <h1 class="menu" id="logo">Hi</h1>
    CSS:
    .menu { color: green; }
    h1 { color: blue; }
    #logo { color: black; }
    (a) yellow (b) green (c) black (d) blue
  22. 22.🎯 Which CSS selector matches this element?
    <p class="menu" id="hero">Hello</p>
    (a) p (b) h1 (c) #top (d) .hero
  23. 23.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 18px;
      }
    }
    (a) No (b) Yes
  24. 24.True or false: JavaScript makes a form box. (a) False (b) True
  25. 25.💪 Which flexbox property lines boxes up across? (a) align-items (b) gap (c) justify-content (d) flex-direction
  26. 26.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 100px;
      padding: 10px;
      border: 4px solid black;
      margin: 0px;
    }
  27. 27.🎯 What kind of selector is p? (a) an id selector (b) a class selector (c) an element selector
  28. 28.True or false: .card is an element selector. (a) True (b) False
  29. 29.⚖️ What colour is the text of this element?
    <h2 class="big" id="hero">Hi</h2>
    CSS:
    #hero { color: yellow; }
    #hero { color: black; }
    (a) purple (b) blue (c) yellow (d) black
  30. 30.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 20px;
      }
    }
    (a) No (b) Yes
  31. 31.🌈 Which hex code is black? (a) #ffff00 (b) #00ff00 (c) #00ffff (d) #000000
  32. 32.✍️ Which property is set to 10px in this rule?
    h1 {
      width: 300px;
      margin: 10px;
      border: 2px solid;
    }
    (a) 10px (b) font-weight (c) padding (d) margin
  33. 33.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 220px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 80px wide (no margins).
  34. 34.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 110px;
      padding: 15px;
      border: 3px solid black;
      margin: 20px;
    }
  35. 35.🌈 Which hex code is white? (a) #00ffff (b) #ffffff (c) #000000 (d) #ffff00
  36. 36.True or false: JavaScript shows a pop-up message. (a) True (b) False
  37. 37.True or false: margin is the gap to other boxes. (a) False (b) True
  38. 38.🖌️ Where does the text sit on its line?
    h1 {
      background-color: orange;
      color: blue;
      text-align: right;
      font-size: 12px;
    }
    (a) on the right (b) in the middle (c) on the left
  39. 39.✍️ What is the selector in this CSS rule?
    #top {
      border: 2px solid;
      margin: 10px;
      text-align: center;
    }
    (a) border (b) #top (c) 10px (d) li
  40. 40.🌈 Which colour is #ff0000? (a) white (b) red (c) yellow (d) black

Answer key

  1. white
  2. <h2 class="red">
  3. False
  4. blue
  5. makes letters bigger
  6. 174
  7. border
  8. font-family
  9. 800px or wider
  10. 166
  11. sets colours and fonts
  12. :
  13. the viewport meta tag
  14. True
  15. HTML
  16. 255
  17. True
  18. blue
  19. 20
  20. <li id="intro">
  21. black
  22. p
  23. No
  24. False
  25. align-items
  26. 128
  27. an element selector
  28. False
  29. black
  30. Yes
  31. #000000
  32. margin
  33. 60
  34. 186
  35. #ffffff
  36. True
  37. True
  38. on the right
  39. #top
  40. red

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