← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 780 · 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.✍️ In color: blue; which part is the value? (a) : (b) ; (c) color (d) blue
  2. 2.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 320px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 60px wide (no margins).
  3. 3.🎨 A CSS file usually ends with which extension? (a) .png (b) .css (c) .html (d) .js
  4. 4.🌈 Which colour is #000000? (a) white (b) bright green (c) blue (d) black
  5. 5.🧩 Which language lays out the page? (a) JavaScript (b) HTML (c) CSS
  6. 6.🌈 Which hex code is bright green? (a) #ffff00 (b) #00ff00 (c) #000000 (d) #ffffff
  7. 7.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 20px;
      }
    }
  8. 8.🖌️ What colour are the letters?
    h2 {
      font-size: 36px;
      text-align: left;
      background-color: green;
      color: purple;
    }
    (a) green (b) yellow (c) purple
  9. 9.✍️ What value is given to color in this rule?
    li {
      font-style: italic;
      padding: 8px;
      color: red;
    }
    (a) color (b) red (c) center (d) 20px
  10. 10.🌈 Which colour is #0000ff? (a) red (b) blue (c) yellow (d) white
  11. 11.🖌️ What colour is behind the letters?
    h2 {
      text-align: center;
      font-size: 16px;
      color: green;
      background-color: red;
    }
    (a) green (b) red (c) purple
  12. 12.🖌️ Which CSS property picks the font style? (a) text-align (b) font-weight (c) font-size (d) font-family
  13. 13.✍️ What is the selector in this CSS rule?
    #top {
      margin: 10px;
      font-weight: bold;
      text-align: center;
    }
    (a) margin (b) li (c) #top (d) bold
  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: 140px;
      padding: 30px;
      border: 1px solid black;
      margin: 15px;
    }
  15. 15.🌈 Which colour is #ffffff? (a) white (b) blue (c) bright green (d) magenta
  16. 16.Which of these does HTML do? (a) gives the page structure (b) sets colours and fonts (c) checks a quiz answer (d) shows a pop-up message
  17. 17.Which of these does JavaScript do? (a) changes the text size (b) reacts to a button click (c) sets colours and fonts (d) puts a picture on a page
  18. 18.🎯 Which CSS selector matches this element?
    <div class="star" id="hero">Hello</div>
    (a) .hero (b) .star (c) #top (d) span
  19. 19.What does font-family do? (a) picks the font style (b) sets the letter colour (c) makes the text bold (d) colours behind the text
  20. 20.⚖️ What colour is the text of this element?
    <h2 class="red" id="main">Hi</h2>
    CSS:
    #main { color: blue; }
    h2 { color: green; }
    .red { color: red; }
    (a) green (b) blue (c) red (d) white
  21. 21.✍️ Which sign ends each CSS declaration? (a) : (b) ; (c) . (d) ,
  22. 22.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 80px;
      padding: 30px;
      border: 1px solid black;
      margin: 0px;
    }
  23. 23.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 230px;
      padding: 5px;
      border: 1px solid black;
      margin: 20px;
    }
  24. 24.💪 Which flexbox property spaces boxes along a row? (a) align-items (b) justify-content (c) display: flex (d) flex-direction
  25. 25.True or false: CSS changes the text size. (a) True (b) False
  26. 26.🧩 Which language adds space around boxes? (a) JavaScript (b) HTML (c) CSS
  27. 27.⚖️ What colour is the text of this element?
    <h2 class="star" id="top">Hi</h2>
    CSS:
    h2 { color: orange; }
    #top { color: blue; }
    .star { color: red; }
    (a) orange (b) yellow (c) red (d) blue
  28. 28.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 230px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  29. 29.🎯 What kind of selector is #hero? (a) an id selector (b) a class selector (c) an element selector
  30. 30.🖌️ How big is the text, in px?
    h1 {
      font-size: 28px;
      color: orange;
      text-align: right;
      background-color: white;
    }
  31. 31.📱 What does a media query check? (a) the time of day (b) the battery level (c) the page title (d) the screen width
  32. 32.⚖️ Which selector is the weakest? (a) a class selector (b) an id selector (c) an element selector
  33. 33.⚖️ What colour is the text of this element?
    <h1 class="note" id="intro">Hi</h1>
    CSS:
    #intro { color: blue; }
    h1 { color: orange; }
    .note { color: white; }
    (a) white (b) orange (c) yellow (d) blue
  34. 34.🎯 Which sign starts an id selector? (a) & (b) @ (c) # (d) .
  35. 35.🎯 Which CSS selector matches this element?
    <h1 class="note" id="main">Hello</h1>
    (a) .note (b) .main (c) h2 (d) .big
  36. 36.What does font-size do? (a) makes the text bold (b) makes letters bigger (c) picks the font style (d) sets the letter colour
  37. 37.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 50px;
      padding: 10px;
      border: 3px solid black;
      margin: 5px;
    }
  38. 38.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 320px;
      justify-content: space-between;
    }
    Inside are 3 boxes, each 100px wide (no margins).
  39. 39.🎨 Which tag holds CSS inside the head? (a) <style> (b) <css> (c) <script> (d) <body>
  40. 40.🎯 Which sign starts a class selector? (a) & (b) . (c) @ (d) #

Answer key

  1. blue
  2. 80
  3. .css
  4. black
  5. CSS
  6. #00ff00
  7. 16
  8. purple
  9. red
  10. blue
  11. red
  12. font-family
  13. #top
  14. 202
  15. white
  16. gives the page structure
  17. reacts to a button click
  18. .star
  19. picks the font style
  20. blue
  21. ;
  22. 142
  23. 242
  24. justify-content
  25. True
  26. CSS
  27. blue
  28. 30
  29. an id selector
  30. 28
  31. the screen width
  32. an element selector
  33. blue
  34. #
  35. .note
  36. makes letters bigger
  37. 86
  38. 10
  39. <style>
  40. .

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