← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 490 · 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 sign starts a class selector? (a) & (b) . (c) # (d) @
  2. 2.True or false: margin is the gap to other boxes. (a) False (b) True
  3. 3.True or false: padding is the gap round content. (a) True (b) False
  4. 4.🖌️ What colour are the letters?
    h1 {
      color: blue;
      background-color: red;
      text-align: left;
      font-size: 20px;
    }
    (a) red (b) blue (c) white
  5. 5.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      font-weight: bold;
      font-style: italic;
      font-size: 20px;
    }
  6. 6.✍️ Which property is set to italic in this rule?
    #top {
      font-style: italic;
      font-weight: bold;
    }
    (a) font-size (b) color (c) font-style (d) italic
  7. 7.🎯 How many elements on a page should have the same id? (a) 2 (b) 1 (c) any number (d) 5
  8. 8.🎨 Which tag connects an outside CSS file? (a) <img> (b) <css> (c) <link> (d) <a>
  9. 9.🖌️ How big is the text, in px?
    h1 {
      text-align: center;
      font-size: 40px;
      background-color: red;
      color: purple;
    }
  10. 10.🌈 Which colour is rgb(0, 255, 255)? (a) white (b) red (c) magenta (d) cyan
  11. 11.🖌️ Which CSS property sets the letter colour? (a) text-align (b) font-size (c) font-weight (d) color
  12. 12.True or false: margin is the text or picture. (a) True (b) False
  13. 13.🧩 Which language rounds box corners? (a) JavaScript (b) HTML (c) CSS
  14. 14.🌈 Which hex code is magenta? (a) #ff0000 (b) #0000ff (c) #ffffff (d) #ff00ff
  15. 15.🎨 Which attribute adds CSS inside one tag? (a) style (b) src (c) href (d) alt
  16. 16.🔍 Which is the odd one out? (a) checks a quiz answer (b) lays out the page (c) rounds box corners (d) adds space around boxes
  17. 17.💪 Which justify-content value packs boxes at the end? (a) space-between (b) flex-start (c) flex-end (d) center
  18. 18.True or false: the border is the text or picture. (a) True (b) False
  19. 19.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 4 (b) 2 (c) 3 (d) 6
  20. 20.🌈 Which colour is #00ffff? (a) cyan (b) black (c) blue (d) white
  21. 21.🖌️ Which CSS property makes letters bigger? (a) font-size (b) font-weight (c) color (d) text-align
  22. 22.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 350px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 80px wide (no margins).
  23. 23.🖌️ How big is the text, in px?
    h2 {
      background-color: blue;
      font-size: 36px;
      text-align: left;
      color: black;
    }
  24. 24.🌈 Which colour is #0000ff? (a) yellow (b) blue (c) red (d) cyan
  25. 25.🎯 Which CSS selector matches this element?
    <div class="note" id="main">Hello</div>
    (a) #note (b) span (c) .main (d) #main
  26. 26.📱 max-width: 600px applies when the screen is ___. (a) 600px or wider (b) 600px or narrower (c) turned off (d) exactly 1000px
  27. 27.⚖️ What colour is the text of this element?
    <p class="menu" id="intro">Hi</p>
    CSS:
    .menu { color: red; }
    #intro { color: green; }
    (a) white (b) black (c) green (d) red
  28. 28.🧩 Which language sets colours and fonts? (a) HTML (b) CSS (c) JavaScript
  29. 29.🎯 Which element does the selector h2 style? (a) <li> (b) <div class="star"> (c) <span id="top"> (d) <h2 class="star">
  30. 30.🎯 What kind of selector is .big? (a) an id selector (b) an element selector (c) a class selector
  31. 31.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 70px;
      padding: 30px;
      border: 2px solid black;
      margin: 0px;
    }
  32. 32.⚖️ What colour is the text of this element?
    <h2 class="box" id="intro">Hi</h2>
    CSS:
    .box { color: white; }
    .box { color: orange; }
    (a) white (b) green (c) orange (d) red
  33. 33.🌈 Which colour of light is strongest in rgb(227, 26, 62)? (a) blue (b) green (c) red
  34. 34.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 280px;
      padding: 15px;
      border: 1px solid black;
      margin: 5px;
    }
  35. 35.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 210px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 60px wide (no margins).
  36. 36.💪 Which flexbox property picks row or column? (a) justify-content (b) flex-direction (c) display: flex (d) gap
  37. 37.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 10px;
      }
    }
    (a) No (b) Yes
  38. 38.🖌️ Which CSS property picks the font style? (a) font-weight (b) text-align (c) color (d) font-family
  39. 39.✍️ How many declarations (property: value pairs) are in this rule?
    body {
      margin: 10px;
      text-align: center;
      width: 300px;
    }
  40. 40.🌈 Which colour is rgb(0, 255, 0)? (a) bright green (b) black (c) yellow (d) red

Answer key

  1. .
  2. True
  3. True
  4. blue
  5. 3
  6. font-style
  7. 1
  8. <link>
  9. 40
  10. cyan
  11. color
  12. False
  13. CSS
  14. #ff00ff
  15. style
  16. checks a quiz answer
  17. flex-end
  18. False
  19. 3
  20. cyan
  21. font-size
  22. 30
  23. 36
  24. blue
  25. #main
  26. 600px or narrower
  27. green
  28. CSS
  29. <h2 class="star">
  30. a class selector
  31. 134
  32. orange
  33. red
  34. 322
  35. 30
  36. flex-direction
  37. Yes
  38. font-family
  39. 3
  40. bright green

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