← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 845 · 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 property? (a) : (b) blue (c) color (d) ;
  2. 2.🖌️ What colour are the letters?
    p {
      background-color: blue;
      font-size: 40px;
      color: black;
      text-align: right;
    }
    (a) blue (b) green (c) black
  3. 3.🌈 Which hex code is cyan? (a) #000000 (b) #00ffff (c) #ffffff (d) #ff0000
  4. 4.⚖️ What colour is the text of this element?
    <h1 class="big" id="logo">Hi</h1>
    CSS:
    h1 { color: blue; }
    h1 { color: white; }
    (a) purple (b) black (c) white (d) blue
  5. 5.🎯 Which element does the selector #main style? (a) <span class="red"> (b) <div id="logo"> (c) <div class="main"> (d) <div id="main">
  6. 6.🔍 Which is the odd one out? (a) gives the page structure (b) makes a form box (c) reacts to a button click (d) makes headings and lists
  7. 7.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 100px;
      padding: 20px;
      border: 4px solid black;
      margin: 0px;
    }
  8. 8.🎯 What kind of selector is .star? (a) an id selector (b) an element selector (c) a class selector
  9. 9.💪 Which flexbox property sets space between boxes? (a) display: flex (b) justify-content (c) align-items (d) gap
  10. 10.🖌️ What colour are the letters?
    li {
      font-size: 16px;
      text-align: left;
      color: white;
      background-color: purple;
    }
    (a) purple (b) orange (c) white
  11. 11.✍️ How does a CSS comment start? (a) # (b) // (c) <!-- (d) /*
  12. 12.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 280px;
      justify-content: center;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  13. 13.🖌️ Where does the text sit on its line?
    h1 {
      text-align: left;
      font-size: 16px;
      background-color: purple;
      color: red;
    }
    (a) in the middle (b) on the right (c) on the left
  14. 14.⚖️ What colour is the text of this element?
    <p class="box" id="hero">Hi</p>
    CSS:
    p { color: purple; }
    p { color: orange; }
    (a) purple (b) yellow (c) orange (d) blue
  15. 15.🖌️ Where does the text sit on its line?
    p {
      background-color: red;
      text-align: left;
      color: purple;
      font-size: 20px;
    }
    (a) in the middle (b) on the left (c) on the right
  16. 16.✍️ What is the selector in this CSS rule?
    .box {
      font-size: 20px;
      font-weight: bold;
    }
    (a) bold (b) font-size (c) h2 (d) .box
  17. 17.🎯 Which sign starts a class selector? (a) @ (b) & (c) . (d) #
  18. 18.Which of these does JavaScript do? (a) counts down a timer (b) puts a picture on a page (c) adds space around boxes (d) gives the page structure
  19. 19.⚖️ What colour is the text of this element?
    <h2 class="big" id="intro">Hi</h2>
    CSS:
    h2 { color: white; }
    .big { color: purple; }
    #intro { color: black; }
    (a) yellow (b) white (c) purple (d) black
  20. 20.What does color do? (a) picks the font style (b) makes the text bold (c) sets the letter colour (d) centres a heading
  21. 21.Which of these does HTML do? (a) shows a pop-up message (b) changes the page live (c) gives the page structure (d) sets colours and fonts
  22. 22.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      font-style: italic;
      width: 300px;
      text-align: center;
    }
  23. 23.⚖️ What colour is the text of this element?
    <h2 class="note" id="end">Hi</h2>
    CSS:
    #end { color: red; }
    h2 { color: orange; }
    (a) orange (b) red (c) blue (d) green
  24. 24.🎨 Which tag connects an outside CSS file? (a) <a> (b) <img> (c) <link> (d) <css>
  25. 25.🌈 Which colour of light is strongest in rgb(47, 46, 251)? (a) blue (b) red (c) green
  26. 26.True or false: CSS lays out the page. (a) True (b) False
  27. 27.✍️ What value is given to color in this rule?
    body {
      color: red;
      font-size: 20px;
      background-color: yellow;
      margin: 10px;
    }
    (a) center (b) red (c) color (d) 20px
  28. 28.📱 Which tag helps phones show a page at the right size? (a) the hr tag (b) the br tag (c) the title tag (d) the viewport meta tag
  29. 29.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 160px;
      padding: 30px;
      border: 2px solid black;
      margin: 15px;
    }
  30. 30.🖌️ Where does the text sit on its line?
    li {
      text-align: right;
      color: orange;
      background-color: black;
      font-size: 12px;
    }
    (a) in the middle (b) on the left (c) on the right
  31. 31.⚖️ What colour is the text of this element?
    <h1 class="big" id="intro">Hi</h1>
    CSS:
    .big { color: green; }
    #intro { color: yellow; }
    (a) red (b) black (c) green (d) yellow
  32. 32.✍️ Which property is set to red in this rule?
    body {
      text-align: center;
      color: red;
      padding: 8px;
      font-weight: bold;
    }
    (a) font-size (b) text-align (c) red (d) color
  33. 33.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 20px;
      }
    }
  34. 34.🖌️ Which CSS property picks the font style? (a) text-align (b) font-size (c) background-color (d) font-family
  35. 35.⚖️ Which selector is the weakest? (a) an id selector (b) an element selector (c) a class selector
  36. 36.What does font-weight do? (a) picks the font style (b) makes the text bold (c) colours behind the text (d) sets the letter colour
  37. 37.⚖️ What colour is the text of this element?
    <h2 class="box" id="hero">Hi</h2>
    CSS:
    h2 { color: orange; }
    .box { color: blue; }
    (a) green (b) white (c) blue (d) orange
  38. 38.⚖️ What colour is the text of this element?
    <h1 class="star" id="end">Hi</h1>
    CSS:
    h1 { color: yellow; }
    h1 { color: purple; }
    (a) yellow (b) purple (c) black (d) green
  39. 39.🌈 Which colour is #ffffff? (a) yellow (b) bright green (c) white (d) blue
  40. 40.🖌️ What colour are the letters?
    h1 {
      font-size: 20px;
      background-color: green;
      color: black;
      text-align: right;
    }
    (a) green (b) red (c) black

Answer key

  1. color
  2. black
  3. #00ffff
  4. white
  5. <div id="main">
  6. reacts to a button click
  7. 148
  8. a class selector
  9. gap
  10. white
  11. /*
  12. 40
  13. on the left
  14. orange
  15. on the left
  16. .box
  17. .
  18. counts down a timer
  19. black
  20. sets the letter colour
  21. gives the page structure
  22. 3
  23. red
  24. <link>
  25. blue
  26. True
  27. red
  28. the viewport meta tag
  29. 224
  30. on the right
  31. yellow
  32. color
  33. 20
  34. font-family
  35. an element selector
  36. makes the text bold
  37. blue
  38. purple
  39. white
  40. black

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