← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 454 · 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 colour of light is strongest in rgb(186, 98, 2)? (a) blue (b) red (c) green
  2. 2.🌈 In #00d200 the green part is the hex number d2. What is it as a normal number?
  3. 3.🔍 Which is the odd one out? (a) adds space around boxes (b) sets colours and fonts (c) lays out the page (d) makes a form box
  4. 4.🖌️ Which CSS property colours behind the text? (a) background-color (b) font-size (c) color (d) font-family
  5. 5.📱 What does a media query check? (a) the battery level (b) the screen width (c) the page title (d) the time of day
  6. 6.🧩 Which language lays out the page? (a) CSS (b) HTML (c) JavaScript
  7. 7.🌈 Which hex code is magenta? (a) #ff0000 (b) #00ff00 (c) #0000ff (d) #ff00ff
  8. 8.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 180px;
      padding: 20px;
      border: 5px solid black;
      margin: 0px;
    }
  9. 9.🌈 Which colour is #000000? (a) black (b) yellow (c) bright green (d) magenta
  10. 10.🌈 Which hex code is blue? (a) #0000ff (b) #000000 (c) #ffff00 (d) #ff0000
  11. 11.🎨 One CSS file can style how many pages? (a) only one image (b) only one word (c) many pages (d) no pages
  12. 12.📱 max-width: 600px applies when the screen is ___. (a) turned off (b) 600px or wider (c) exactly 1000px (d) 600px or narrower
  13. 13.What does justify-content: space-between do? (a) equal gaps, none at ends (b) packs boxes at the start (c) packs boxes at the end (d) puts boxes in the middle
  14. 14.True or false: margin is space outside the border. (a) True (b) False
  15. 15.🌈 In #rrggbb, which colour do the last two digits give? (a) green (b) blue (c) white (d) red
  16. 16.What does text-align do? (a) picks the font style (b) colours behind the text (c) centres a heading (d) makes the text bold
  17. 17.🎯 Can many elements share the same class? (a) No (b) Yes
  18. 18.🖌️ Which CSS property picks the font style? (a) background-color (b) font-size (c) text-align (d) font-family
  19. 19.💪 Which flexbox property turns on flexbox? (a) gap (b) display: flex (c) flex-direction (d) align-items
  20. 20.🖌️ Which CSS property sets the letter colour? (a) font-weight (b) font-size (c) color (d) background-color
  21. 21.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 240px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 80px wide (no margins).
  22. 22.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 420px;
      justify-content: center;
    }
    Inside are 4 boxes, each 80px wide (no margins).
  23. 23.True or false: padding is space inside the border. (a) True (b) False
  24. 24.True or false: .note is an element selector. (a) False (b) True
  25. 25.🧩 Which language makes headings and lists? (a) JavaScript (b) HTML (c) CSS
  26. 26.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 22px;
      }
    }
    (a) No (b) Yes
  27. 27.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 10px;
      }
    }
    (a) No (b) Yes
  28. 28.✍️ What value is given to width in this rule?
    h1 {
      width: 300px;
      font-size: 20px;
      border: 2px solid;
    }
    (a) red (b) italic (c) 300px (d) width
  29. 29.What does justify-content: flex-start do? (a) packs boxes at the end (b) puts boxes in the middle (c) equal gaps, none at ends (d) packs boxes at the start
  30. 30.✍️ Which sign ends each CSS declaration? (a) : (b) . (c) ; (d) ,
  31. 31.🎯 Which CSS selector matches this element?
    <h2 class="red" id="main">Hello</h2>
    (a) li (b) #red (c) .box (d) h2
  32. 32.🎯 Which CSS selector matches this element?
    <span class="big" id="intro">Hello</span>
    (a) #big (b) #main (c) span (d) .intro
  33. 33.True or false: the border is space inside the border. (a) False (b) True
  34. 34.⚖️ Which selector is the weakest? (a) an element selector (b) an id selector (c) a class selector
  35. 35.💪 Which justify-content value packs boxes at the end? (a) flex-start (b) center (c) space-between (d) flex-end
  36. 36.✍️ How many declarations (property: value pairs) are in this rule?
    body {
      color: red;
      font-style: italic;
      font-size: 20px;
      width: 300px;
    }
  37. 37.⚖️ What colour is the text of this element?
    <h1 class="big" id="top">Hi</h1>
    CSS:
    h1 { color: yellow; }
    .big { color: blue; }
    (a) purple (b) blue (c) yellow (d) red
  38. 38.🎯 Which CSS selector matches this element?
    <h1 class="note" id="hero">Hello</h1>
    (a) #hero (b) h2 (c) .hero (d) #note
  39. 39.⚖️ What colour is the text of this element?
    <p class="menu" id="hero">Hi</p>
    CSS:
    .menu { color: red; }
    .menu { color: white; }
    (a) white (b) red (c) green (d) blue
  40. 40.🎯 What kind of selector is #hero? (a) an id selector (b) a class selector (c) an element selector

Answer key

  1. red
  2. 210
  3. makes a form box
  4. background-color
  5. the screen width
  6. CSS
  7. #ff00ff
  8. 230
  9. black
  10. #0000ff
  11. many pages
  12. 600px or narrower
  13. equal gaps, none at ends
  14. True
  15. blue
  16. centres a heading
  17. Yes
  18. font-family
  19. display: flex
  20. color
  21. 80
  22. 50
  23. True
  24. False
  25. HTML
  26. Yes
  27. No
  28. 300px
  29. packs boxes at the start
  30. ;
  31. h2
  32. span
  33. False
  34. an element selector
  35. flex-end
  36. 4
  37. blue
  38. #hero
  39. white
  40. an id selector

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