← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 134 · 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.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 150px;
      padding: 25px;
      border: 3px solid black;
      margin: 10px;
    }
  2. 2.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 50px;
      padding: 30px;
      border: 5px solid black;
      margin: 15px;
    }
  3. 3.🎯 Which CSS selector matches this element?
    <li class="note" id="intro">Hello</li>
    (a) li (b) #note (c) .big (d) .intro
  4. 4.✍️ What value is given to background-color in this rule?
    li {
      padding: 8px;
      font-size: 20px;
      background-color: yellow;
    }
    (a) background-color (b) yellow (c) 8px (d) 10px
  5. 5.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 170px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 40px wide (no margins).
  6. 6.🔍 Which is the odd one out? (a) makes headings and lists (b) makes a link (c) checks a quiz answer (d) gives the page structure
  7. 7.🧩 Which language rounds box corners? (a) JavaScript (b) HTML (c) CSS
  8. 8.🔍 Which is the odd one out? (a) changes the text size (b) sets colours and fonts (c) adds space around boxes (d) makes a link
  9. 9.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 18px;
      }
    }
  10. 10.✍️ Which property is set to red in this rule?
    .box {
      font-size: 20px;
      color: red;
      width: 300px;
    }
    (a) red (b) text-align (c) color (d) font-size
  11. 11.🧩 Which language adds space around boxes? (a) CSS (b) JavaScript (c) HTML
  12. 12.What does font-size do? (a) sets the letter colour (b) colours behind the text (c) makes letters bigger (d) centres a heading
  13. 13.✍️ In color: blue; which part is the value? (a) ; (b) blue (c) : (d) color
  14. 14.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 170px;
      padding: 30px;
      border: 3px solid black;
      margin: 15px;
    }
  15. 15.📱 max-width: 600px applies when the screen is ___. (a) 600px or wider (b) turned off (c) exactly 1000px (d) 600px or narrower
  16. 16.True or false: margin is the text or picture. (a) False (b) True
  17. 17.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 210px;
      padding: 10px;
      border: 2px solid black;
      margin: 0px;
    }
  18. 18.🌈 Which colour of light is strongest in rgb(56, 249, 89)? (a) green (b) red (c) blue
  19. 19.True or false: .card is an id selector. (a) False (b) True
  20. 20.💪 Which flexbox property spaces boxes along a row? (a) gap (b) justify-content (c) display: flex (d) flex-direction
  21. 21.🌈 Which colour is #00ff00? (a) blue (b) white (c) yellow (d) bright green
  22. 22.✍️ Which sign ends each CSS declaration? (a) . (b) : (c) ; (d) ,
  23. 23.🎯 What kind of selector is p? (a) an element selector (b) an id selector (c) a class selector
  24. 24.📱 What does a media query check? (a) the battery level (b) the time of day (c) the page title (d) the screen width
  25. 25.True or false: padding is the text or picture. (a) True (b) False
  26. 26.🌈 Which hex code is white? (a) #ffffff (b) #00ffff (c) #000000 (d) #ff0000
  27. 27.💪 Which flexbox property picks row or column? (a) align-items (b) gap (c) flex-direction (d) display: flex
  28. 28.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 16px;
      }
    }
  29. 29.⚖️ What colour is the text of this element?
    <p class="box" id="end">Hi</p>
    CSS:
    #end { color: green; }
    .box { color: black; }
    (a) red (b) green (c) yellow (d) black
  30. 30.🖌️ Which CSS property makes the text bold? (a) font-weight (b) background-color (c) font-family (d) text-align
  31. 31.⚖️ What colour is the text of this element?
    <h2 class="star" id="end">Hi</h2>
    CSS:
    .star { color: yellow; }
    h2 { color: black; }
    (a) black (b) orange (c) red (d) yellow
  32. 32.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      width: 300px;
      font-style: italic;
    }
  33. 33.🌈 In #7e0000 the red part is the hex number 7e. What is it as a normal number?
  34. 34.🌈 Which colour is rgb(255, 0, 0)? (a) magenta (b) blue (c) red (d) black
  35. 35.🧩 Which language makes a form box? (a) CSS (b) JavaScript (c) HTML
  36. 36.🧩 Which language gives the page structure? (a) HTML (b) JavaScript (c) CSS
  37. 37.🎯 What kind of selector is #top? (a) an id selector (b) an element selector (c) a class selector
  38. 38.True or false: JavaScript puts a picture on a page. (a) False (b) True
  39. 39.🎯 Which CSS selector matches this element?
    <li class="menu" id="top">Hello</li>
    (a) #intro (b) .note (c) #menu (d) #top
  40. 40.⚖️ What colour is the text of this element?
    <p class="star" id="logo">Hi</p>
    CSS:
    .star { color: black; }
    .star { color: red; }
    (a) purple (b) orange (c) red (d) black

Answer key

  1. 206
  2. 150
  3. li
  4. yellow
  5. 50
  6. checks a quiz answer
  7. CSS
  8. makes a link
  9. 16
  10. color
  11. CSS
  12. makes letters bigger
  13. blue
  14. 236
  15. 600px or narrower
  16. False
  17. 234
  18. green
  19. False
  20. justify-content
  21. bright green
  22. ;
  23. an element selector
  24. the screen width
  25. False
  26. #ffffff
  27. flex-direction
  28. 16
  29. green
  30. font-weight
  31. yellow
  32. 2
  33. 126
  34. red
  35. HTML
  36. HTML
  37. an id selector
  38. False
  39. #top
  40. red

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