← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 852 · 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.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 14px;
      }
    }
  2. 2.🖌️ What colour is behind the letters?
    p {
      text-align: right;
      color: red;
      background-color: black;
      font-size: 40px;
    }
    (a) red (b) orange (c) black
  3. 3.🖌️ How big is the text, in px?
    li {
      background-color: green;
      text-align: left;
      font-size: 16px;
      color: orange;
    }
  4. 4.✍️ What is the selector in this CSS rule?
    #top {
      width: 300px;
      font-size: 20px;
    }
    (a) 20px (b) width (c) li (d) #top
  5. 5.💪 Which flexbox property picks row or column? (a) display: flex (b) justify-content (c) flex-direction (d) align-items
  6. 6.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 50px;
      padding: 30px;
      border: 4px solid black;
      margin: 15px;
    }
  7. 7.🔍 Which is the odd one out? (a) adds space around boxes (b) changes the text size (c) rounds box corners (d) makes headings and lists
  8. 8.📱 Which tag helps phones show a page at the right size? (a) the hr tag (b) the title tag (c) the br tag (d) the viewport meta tag
  9. 9.🖌️ Where does the text sit on its line?
    li {
      text-align: center;
      font-size: 28px;
      color: yellow;
      background-color: blue;
    }
    (a) on the left (b) on the right (c) in the middle
  10. 10.True or false: the border is the line round the box. (a) False (b) True
  11. 11.True or false: #main is an id selector. (a) True (b) False
  12. 12.🖌️ Which CSS property makes letters bigger? (a) font-family (b) font-weight (c) font-size (d) background-color
  13. 13.⚖️ What colour is the text of this element?
    <h1 class="menu" id="hero">Hi</h1>
    CSS:
    .menu { color: purple; }
    .menu { color: blue; }
    (a) purple (b) blue (c) white (d) black
  14. 14.✍️ What is the selector in this CSS rule?
    li {
      border: 2px solid;
      padding: 8px;
      font-size: 20px;
      color: red;
    }
    (a) 8px (b) li (c) body (d) border
  15. 15.🌈 Which colour is #0000ff? (a) bright green (b) red (c) blue (d) black
  16. 16.🧩 Which language makes a link? (a) CSS (b) JavaScript (c) HTML
  17. 17.What does font-size do? (a) makes letters bigger (b) sets the letter colour (c) makes the text bold (d) colours behind the text
  18. 18.⚖️ What colour is the text of this element?
    <h2 class="menu" id="main">Hi</h2>
    CSS:
    h2 { color: black; }
    .menu { color: green; }
    (a) orange (b) yellow (c) black (d) green
  19. 19.🧩 Which language counts down a timer? (a) JavaScript (b) CSS (c) HTML
  20. 20.⚖️ What colour is the text of this element?
    <h2 class="star" id="hero">Hi</h2>
    CSS:
    .star { color: black; }
    .star { color: yellow; }
    (a) blue (b) black (c) green (d) yellow
  21. 21.🎯 Which element does the selector span style? (a) <h2 id="top"> (b) <p> (c) <span class="note"> (d) <h1 class="note">
  22. 22.🧩 Which language makes a form box? (a) JavaScript (b) CSS (c) HTML
  23. 23.⚖️ What colour is the text of this element?
    <h1 class="big" id="logo">Hi</h1>
    CSS:
    .big { color: blue; }
    .big { color: black; }
    (a) black (b) green (c) purple (d) blue
  24. 24.🎨 Which tag holds CSS inside the head? (a) <style> (b) <body> (c) <script> (d) <css>
  25. 25.True or false: margin is space outside the border. (a) True (b) False
  26. 26.⚖️ What colour is the text of this element?
    <h2 class="big" id="top">Hi</h2>
    CSS:
    h2 { color: purple; }
    #top { color: red; }
    .big { color: yellow; }
    (a) red (b) purple (c) yellow (d) orange
  27. 27.✍️ What is the selector in this CSS rule?
    p {
      font-size: 20px;
      text-align: center;
      font-style: italic;
      background-color: yellow;
    }
    (a) p (b) font-size (c) .note (d) center
  28. 28.True or false: CSS adds space around boxes. (a) True (b) False
  29. 29.📱 min-width: 800px applies when the screen is ___. (a) 800px or wider (b) turned off (c) 800px or narrower (d) exactly 100px
  30. 30.🖌️ What colour are the letters?
    p {
      text-align: center;
      color: yellow;
      background-color: green;
      font-size: 40px;
    }
    (a) blue (b) yellow (c) green
  31. 31.🖌️ Where does the text sit on its line?
    p {
      text-align: center;
      color: yellow;
      font-size: 32px;
      background-color: black;
    }
    (a) on the left (b) on the right (c) in the middle
  32. 32.⚖️ What colour is the text of this element?
    <p class="big" id="logo">Hi</p>
    CSS:
    p { color: purple; }
    .big { color: orange; }
    (a) green (b) orange (c) purple (d) red
  33. 33.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      margin: 10px;
      padding: 8px;
      border: 2px solid;
      font-size: 20px;
    }
  34. 34.🎨 One CSS file can style how many pages? (a) many pages (b) only one image (c) no pages (d) only one word
  35. 35.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) the first one (c) neither (d) the later one
  36. 36.🎯 Which CSS selector matches this element?
    <div class="red" id="logo">Hello</div>
    (a) .red (b) .box (c) span (d) #end
  37. 37.✍️ Which sign goes between a property and its value? (a) : (b) ; (c) = (d) -
  38. 38.🌈 Which colour is #00ff00? (a) magenta (b) bright green (c) cyan (d) black
  39. 39.🎯 Which sign starts a class selector? (a) @ (b) & (c) # (d) .
  40. 40.Which of these does CSS do? (a) makes a form box (b) rounds box corners (c) checks a quiz answer (d) reacts to a button click

Answer key

  1. 20
  2. black
  3. 16
  4. #top
  5. flex-direction
  6. 148
  7. makes headings and lists
  8. the viewport meta tag
  9. in the middle
  10. True
  11. True
  12. font-size
  13. blue
  14. li
  15. blue
  16. HTML
  17. makes letters bigger
  18. green
  19. JavaScript
  20. yellow
  21. <span class="note">
  22. HTML
  23. black
  24. <style>
  25. True
  26. red
  27. p
  28. True
  29. 800px or wider
  30. yellow
  31. in the middle
  32. orange
  33. 4
  34. many pages
  35. the later one
  36. .red
  37. :
  38. bright green
  39. .
  40. rounds box corners

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