← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 450 · 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.True or false: margin is space inside the border. (a) False (b) True
  2. 2.🎯 What kind of selector is body? (a) an element selector (b) an id selector (c) a class selector
  3. 3.🎯 Which sign starts a class selector? (a) @ (b) & (c) # (d) .
  4. 4.🖌️ Where does the text sit on its line?
    li {
      font-size: 28px;
      color: white;
      text-align: left;
      background-color: black;
    }
    (a) in the middle (b) on the left (c) on the right
  5. 5.🎯 Which CSS selector matches this element?
    <p class="red" id="intro">Hello</p>
    (a) .box (b) h1 (c) .red (d) #red
  6. 6.Which of these does CSS do? (a) counts down a timer (b) reacts to a button click (c) lays out the page (d) puts a picture on a page
  7. 7.True or false: HTML makes headings and lists. (a) False (b) True
  8. 8.⚖️ Which selector is the strongest? (a) a class selector (b) an id selector (c) an element selector
  9. 9.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 16px;
      }
    }
  10. 10.✍️ How many declarations (property: value pairs) are in this rule?
    #top {
      background-color: yellow;
    }
  11. 11.✍️ What value is given to font-weight in this rule?
    p {
      width: 300px;
      font-weight: bold;
    }
    (a) 2px solid (b) bold (c) font-weight (d) 300px
  12. 12.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 180px;
      justify-content: flex-end;
    }
    Inside are 3 boxes, each 40px wide (no margins).
  13. 13.🌈 Which colour is #ff0000? (a) bright green (b) black (c) red (d) white
  14. 14.🔍 Which is the odd one out? (a) makes a form box (b) makes headings and lists (c) checks a quiz answer (d) puts a picture on a page
  15. 15.🎯 Which element does the selector #logo style? (a) <h2 class="logo"> (b) <h2 id="end"> (c) <h2 id="logo"> (d) <li class="big">
  16. 16.💪 Which justify-content value packs boxes at the end? (a) flex-start (b) space-between (c) flex-end (d) center
  17. 17.🌈 Which colour is rgb(255, 255, 255)? (a) magenta (b) red (c) cyan (d) white
  18. 18.⚖️ What colour is the text of this element?
    <h1 class="menu" id="hero">Hi</h1>
    CSS:
    .menu { color: black; }
    .menu { color: blue; }
    (a) red (b) black (c) blue (d) purple
  19. 19.📱 What does a media query check? (a) the page title (b) the battery level (c) the screen width (d) the time of day
  20. 20.🖌️ Which CSS property centres a heading? (a) background-color (b) font-size (c) text-align (d) font-weight
  21. 21.⚖️ What colour is the text of this element?
    <p class="big" id="intro">Hi</p>
    CSS:
    p { color: blue; }
    p { color: white; }
    (a) white (b) purple (c) orange (d) blue
  22. 22.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 6px;
      }
    }
    (a) Yes (b) No
  23. 23.🖌️ What colour are the letters?
    p {
      font-size: 28px;
      text-align: right;
      color: orange;
      background-color: white;
    }
    (a) orange (b) red (c) white
  24. 24.🎯 What kind of selector is #top? (a) a class selector (b) an id selector (c) an element selector
  25. 25.🌈 What is the biggest number one colour can have in rgb()? (a) 100 (b) 99 (c) 1000 (d) 255
  26. 26.Which of these is the border? (a) a solid or dotted edge (b) space inside the border (c) space outside the border (d) the gap round content
  27. 27.🖌️ What colour are the letters?
    h1 {
      font-size: 24px;
      background-color: yellow;
      color: blue;
      text-align: right;
    }
    (a) blue (b) yellow (c) red
  28. 28.🌈 Which hex code is cyan? (a) #ffffff (b) #0000ff (c) #00ff00 (d) #00ffff
  29. 29.🎯 Which element does the selector span style? (a) <h2 id="hero"> (b) <p> (c) <h1 class="menu"> (d) <span class="menu">
  30. 30.🧩 Which language makes a link? (a) JavaScript (b) CSS (c) HTML
  31. 31.🎯 Which element does the selector li style? (a) <li class="menu"> (b) <div> (c) <p id="main"> (d) <span class="menu">
  32. 32.✍️ How does a CSS comment start? (a) // (b) /* (c) # (d) <!--
  33. 33.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 50px;
      padding: 25px;
      border: 1px solid black;
      margin: 15px;
    }
  34. 34.🖌️ How big is the text, in px?
    h2 {
      font-size: 40px;
      background-color: yellow;
      text-align: right;
      color: black;
    }
  35. 35.🎨 Which tag holds CSS inside the head? (a) <script> (b) <body> (c) <style> (d) <css>
  36. 36.🎯 Which CSS selector matches this element?
    <div class="box" id="main">Hello</div>
    (a) div (b) #box (c) span (d) #logo
  37. 37.⚖️ What colour is the text of this element?
    <h1 class="red" id="top">Hi</h1>
    CSS:
    .red { color: white; }
    .red { color: orange; }
    (a) white (b) orange (c) yellow (d) purple
  38. 38.🌈 In #rrggbb, which colour do the first two digits give? (a) green (b) black (c) blue (d) red
  39. 39.🖌️ What colour are the letters?
    h1 {
      color: white;
      background-color: orange;
      text-align: right;
      font-size: 24px;
    }
    (a) white (b) orange (c) yellow
  40. 40.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 100px;
      padding: 30px;
      border: 2px solid black;
      margin: 0px;
    }

Answer key

  1. False
  2. an element selector
  3. .
  4. on the left
  5. .red
  6. lays out the page
  7. True
  8. an id selector
  9. 16
  10. 1
  11. bold
  12. 60
  13. red
  14. checks a quiz answer
  15. <h2 id="logo">
  16. flex-end
  17. white
  18. blue
  19. the screen width
  20. text-align
  21. white
  22. No
  23. orange
  24. an id selector
  25. 255
  26. a solid or dotted edge
  27. blue
  28. #00ffff
  29. <span class="menu">
  30. HTML
  31. <li class="menu">
  32. /*
  33. 132
  34. 40
  35. <style>
  36. div
  37. orange
  38. red
  39. white
  40. 164

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