← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 115 · 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?
    <p class="star" id="main">Hi</p>
    CSS:
    #main { color: orange; }
    p { color: blue; }
    (a) orange (b) purple (c) yellow (d) blue
  2. 2.What does justify-content: space-between do? (a) packs boxes at the end (b) packs boxes at the start (c) equal gaps, none at ends (d) puts boxes in the middle
  3. 3.True or false: padding is space inside the border. (a) True (b) False
  4. 4.⚖️ What colour is the text of this element?
    <h1 class="box" id="logo">Hi</h1>
    CSS:
    h1 { color: purple; }
    h1 { color: white; }
    (a) black (b) white (c) yellow (d) purple
  5. 5.⚖️ What colour is the text of this element?
    <p class="note" id="logo">Hi</p>
    CSS:
    .note { color: green; }
    .note { color: white; }
    (a) blue (b) green (c) white (d) red
  6. 6.📦 In the box model, which part is the gap round content? (a) margin (b) content (c) padding (d) border
  7. 7.⚖️ What colour is the text of this element?
    <h2 class="box" id="intro">Hi</h2>
    CSS:
    .box { color: white; }
    h2 { color: green; }
    (a) yellow (b) green (c) white (d) purple
  8. 8.✍️ CSS declarations go inside which brackets? (a) ( ) (b) < > (c) { } (d) [ ]
  9. 9.🌈 What is the biggest number one colour can have in rgb()? (a) 255 (b) 100 (c) 1000 (d) 99
  10. 10.🔍 Which is the odd one out? (a) rounds box corners (b) makes a link (c) changes the text size (d) adds space around boxes
  11. 11.📱 The screen is 820px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 10px;
      }
    }
    (a) Yes (b) No
  12. 12.💪 Which justify-content value equal gaps, none at ends? (a) flex-end (b) space-between (c) flex-start (d) center
  13. 13.🖌️ Where does the text sit on its line?
    li {
      color: red;
      background-color: orange;
      font-size: 40px;
      text-align: left;
    }
    (a) on the left (b) on the right (c) in the middle
  14. 14.🎯 Which element does the selector p style? (a) <p class="menu"> (b) <li id="top"> (c) <h2 class="menu"> (d) <h1>
  15. 15.✍️ What value is given to font-style in this rule?
    h2 {
      font-style: italic;
      text-align: center;
    }
    (a) red (b) italic (c) 20px (d) font-style
  16. 16.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 200px;
      padding: 20px;
      border: 5px solid black;
      margin: 0px;
    }
  17. 17.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 20px;
      }
    }
    (a) No (b) Yes
  18. 18.🎯 Which CSS selector matches this element?
    <h1 class="menu" id="intro">Hello</h1>
    (a) #menu (b) h2 (c) #main (d) #intro
  19. 19.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 230px;
      justify-content: center;
    }
    Inside are 3 boxes, each 50px wide (no margins).
  20. 20.True or false: .note is an element selector. (a) True (b) False
  21. 21.🎯 Which CSS selector matches this element?
    <h2 class="box" id="hero">Hello</h2>
    (a) .hero (b) #box (c) h2 (d) li
  22. 22.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 220px;
      justify-content: center;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  23. 23.🔍 Which is the odd one out? (a) shows a pop-up message (b) counts down a timer (c) changes the page live (d) adds space around boxes
  24. 24.True or false: h1 is an element selector. (a) False (b) True
  25. 25.📱 min-width: 800px applies when the screen is ___. (a) exactly 100px (b) turned off (c) 800px or narrower (d) 800px or wider
  26. 26.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 22px;
      }
    }
    (a) Yes (b) No
  27. 27.✍️ In color: blue; which part is the property? (a) ; (b) color (c) : (d) blue
  28. 28.🌈 Which colour of light is strongest in rgb(121, 0, 166)? (a) blue (b) green (c) red
  29. 29.🧩 Which language checks a quiz answer? (a) CSS (b) HTML (c) JavaScript
  30. 30.🌈 In #4a0000 the red part is the hex number 4a. What is it as a normal number?
  31. 31.⚖️ Which selector is the strongest? (a) an element selector (b) a class selector (c) an id selector
  32. 32.🎯 What kind of selector is h1? (a) an element selector (b) a class selector (c) an id selector
  33. 33.What does text-align do? (a) makes the text bold (b) picks the font style (c) colours behind the text (d) centres a heading
  34. 34.🧩 Which language makes headings and lists? (a) JavaScript (b) HTML (c) CSS
  35. 35.🌈 Which colour is #0000ff? (a) bright green (b) black (c) cyan (d) blue
  36. 36.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 280px;
      padding: 10px;
      border: 1px solid black;
      margin: 15px;
    }
  37. 37.Which of these does HTML do? (a) sets colours and fonts (b) makes a form box (c) reacts to a button click (d) lays out the page
  38. 38.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 16px;
      }
    }
  39. 39.🌈 Which hex code is blue? (a) #ffffff (b) #ffff00 (c) #00ffff (d) #0000ff
  40. 40.🎯 Which element does the selector #end style? (a) <h2 class="note"> (b) <h1 class="end"> (c) <h1 id="hero"> (d) <h1 id="end">

Answer key

  1. orange
  2. equal gaps, none at ends
  3. True
  4. white
  5. white
  6. padding
  7. white
  8. { }
  9. 255
  10. makes a link
  11. No
  12. space-between
  13. on the left
  14. <p class="menu">
  15. italic
  16. 250
  17. Yes
  18. #intro
  19. 40
  20. False
  21. h2
  22. 50
  23. adds space around boxes
  24. True
  25. 800px or wider
  26. Yes
  27. color
  28. blue
  29. JavaScript
  30. 74
  31. an id selector
  32. an element selector
  33. centres a heading
  34. HTML
  35. blue
  36. 332
  37. makes a form box
  38. 16
  39. #0000ff
  40. <h1 id="end">

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