← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 135 · 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 hex code is red? (a) #000000 (b) #00ffff (c) #ff00ff (d) #ff0000
  2. 2.🔍 Which is the odd one out? (a) shows a pop-up message (b) makes a link (c) puts a picture on a page (d) makes headings and lists
  3. 3.✍️ Which sign ends each CSS declaration? (a) ; (b) . (c) : (d) ,
  4. 4.⚖️ What colour is the text of this element?
    <h1 class="note" id="top">Hi</h1>
    CSS:
    .note { color: white; }
    h1 { color: red; }
    #top { color: blue; }
    (a) white (b) yellow (c) blue (d) red
  5. 5.💪 Which flexbox property turns on flexbox? (a) display: flex (b) flex-direction (c) justify-content (d) align-items
  6. 6.🖌️ Where does the text sit on its line?
    h1 {
      background-color: red;
      text-align: left;
      color: purple;
      font-size: 40px;
    }
    (a) in the middle (b) on the right (c) on the left
  7. 7.🎨 What does CSS stand for? (a) Cascading Style Sheets (b) Creative Sheet System (c) Computer Style Sheets (d) Colourful Site Styles
  8. 8.⚖️ What colour is the text of this element?
    <h2 class="big" id="main">Hi</h2>
    CSS:
    .big { color: purple; }
    #main { color: green; }
    h2 { color: red; }
    (a) purple (b) green (c) blue (d) red
  9. 9.🎯 Which element does the selector li style? (a) <p id="hero"> (b) <li class="menu"> (c) <div> (d) <span class="menu">
  10. 10.🎯 What kind of selector is .card? (a) an id selector (b) an element selector (c) a class selector
  11. 11.⚖️ Which selector is the strongest? (a) an id selector (b) a class selector (c) an element selector
  12. 12.What does justify-content: flex-start do? (a) puts boxes in the middle (b) packs boxes at the end (c) equal gaps, none at ends (d) packs boxes at the start
  13. 13.⚖️ What colour is the text of this element?
    <h2 class="menu" id="logo">Hi</h2>
    CSS:
    #logo { color: black; }
    h2 { color: white; }
    (a) red (b) blue (c) white (d) black
  14. 14.📱 What does a media query check? (a) the page title (b) the battery level (c) the screen width (d) the time of day
  15. 15.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 32px;
      }
    }
    (a) Yes (b) No
  16. 16.💪 Which flexbox property spaces boxes along a row? (a) display: flex (b) justify-content (c) flex-direction (d) gap
  17. 17.🎯 Which CSS selector matches this element?
    <p class="box" id="top">Hello</p>
    (a) .star (b) #box (c) #intro (d) p
  18. 18.⚖️ What colour is the text of this element?
    <h2 class="note" id="main">Hi</h2>
    CSS:
    #main { color: white; }
    #main { color: yellow; }
    (a) white (b) yellow (c) blue (d) green
  19. 19.What does font-family do? (a) picks the font style (b) sets the letter colour (c) makes letters bigger (d) makes the text bold
  20. 20.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      width: 300px;
    }
  21. 21.🖌️ Which CSS property picks the font style? (a) font-size (b) background-color (c) color (d) font-family
  22. 22.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      border: 2px solid;
    }
  23. 23.🎯 Which element does the selector li style? (a) <div> (b) <li class="note"> (c) <p id="main"> (d) <span class="note">
  24. 24.🎯 What kind of selector is #main? (a) a class selector (b) an id selector (c) an element selector
  25. 25.⚖️ What colour is the text of this element?
    <p class="red" id="hero">Hi</p>
    CSS:
    p { color: black; }
    p { color: red; }
    (a) red (b) yellow (c) green (d) black
  26. 26.🖌️ Which CSS property sets the letter colour? (a) text-align (b) color (c) font-size (d) font-weight
  27. 27.🎨 Which tag connects an outside CSS file? (a) <a> (b) <css> (c) <img> (d) <link>
  28. 28.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      font-weight: bold;
    }
  29. 29.🌈 In #rrggbb, which colour do the last two digits give? (a) green (b) red (c) blue (d) white
  30. 30.True or false: margin is the line round the box. (a) False (b) True
  31. 31.🎯 Which element does the selector #end style? (a) <p id="hero"> (b) <p id="end"> (c) <p class="end"> (d) <h1 class="box">
  32. 32.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 190px;
      padding: 15px;
      border: 1px solid black;
      margin: 10px;
    }
  33. 33.🎯 What kind of selector is .big? (a) a class selector (b) an id selector (c) an element selector
  34. 34.🖌️ Which CSS property makes the text bold? (a) color (b) background-color (c) text-align (d) font-weight
  35. 35.🖌️ What colour are the letters?
    p {
      background-color: purple;
      text-align: left;
      color: blue;
      font-size: 36px;
    }
    (a) purple (b) blue (c) orange
  36. 36.🧩 Which language lays out the page? (a) JavaScript (b) CSS (c) HTML
  37. 37.🌈 Which colour of light is strongest in rgb(160, 36, 67)? (a) green (b) red (c) blue
  38. 38.🌈 In #000000 the red part is the hex number 00. What is it as a normal number?
  39. 39.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 12px;
      }
    }
    (a) Yes (b) No
  40. 40.⚖️ What colour is the text of this element?
    <h1 class="menu" id="intro">Hi</h1>
    CSS:
    h1 { color: blue; }
    h1 { color: red; }
    (a) orange (b) red (c) yellow (d) blue

Answer key

  1. #ff0000
  2. shows a pop-up message
  3. ;
  4. blue
  5. display: flex
  6. on the left
  7. Cascading Style Sheets
  8. green
  9. <li class="menu">
  10. a class selector
  11. an id selector
  12. packs boxes at the start
  13. black
  14. the screen width
  15. No
  16. justify-content
  17. p
  18. yellow
  19. picks the font style
  20. 1
  21. font-family
  22. 1
  23. <li class="note">
  24. an id selector
  25. red
  26. color
  27. <link>
  28. 1
  29. blue
  30. False
  31. <p id="end">
  32. 242
  33. a class selector
  34. font-weight
  35. blue
  36. CSS
  37. red
  38. 0
  39. Yes
  40. red

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