← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 539 · 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 does justify-content: flex-end do? (a) equal gaps, none at ends (b) packs boxes at the end (c) packs boxes at the start (d) puts boxes in the middle
  2. 2.🌈 Which colour is rgb(0, 255, 255)? (a) cyan (b) magenta (c) red (d) black
  3. 3.🖌️ What colour is behind the letters?
    p {
      text-align: center;
      font-size: 28px;
      background-color: black;
      color: orange;
    }
    (a) black (b) green (c) orange
  4. 4.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 190px;
      padding: 10px;
      border: 5px solid black;
      margin: 15px;
    }
  5. 5.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      color: red;
      text-align: center;
      margin: 10px;
      border: 2px solid;
    }
  6. 6.💪 Which flexbox property sets space between boxes? (a) display: flex (b) flex-direction (c) justify-content (d) gap
  7. 7.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 8px;
      }
    }
  8. 8.📱 What does a media query check? (a) the page title (b) the time of day (c) the battery level (d) the screen width
  9. 9.✍️ Which property is set to center in this rule?
    h1 {
      text-align: center;
      padding: 8px;
      color: red;
      font-weight: bold;
    }
    (a) text-align (b) margin (c) background-color (d) center
  10. 10.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 280px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  11. 11.✍️ Which property is set to 8px in this rule?
    h2 {
      width: 300px;
      font-size: 20px;
      padding: 8px;
      background-color: yellow;
    }
    (a) font-weight (b) padding (c) 8px (d) border
  12. 12.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      text-align: center;
      border: 2px solid;
    }
  13. 13.🎨 Which attribute adds CSS inside one tag? (a) style (b) alt (c) src (d) href
  14. 14.True or false: HTML makes headings and lists. (a) False (b) True
  15. 15.🧩 Which language makes headings and lists? (a) HTML (b) JavaScript (c) CSS
  16. 16.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 10px;
      }
    }
  17. 17.💪 Which flexbox property picks row or column? (a) align-items (b) flex-direction (c) display: flex (d) justify-content
  18. 18.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 330px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 60px wide (no margins).
  19. 19.🎯 Which element does the selector p style? (a) <h2 class="red"> (b) <p class="red"> (c) <h1> (d) <li id="intro">
  20. 20.🧩 Which language makes a form box? (a) CSS (b) HTML (c) JavaScript
  21. 21.⚖️ Which selector is the weakest? (a) an id selector (b) an element selector (c) a class selector
  22. 22.What does font-weight do? (a) makes the text bold (b) sets the letter colour (c) makes letters bigger (d) colours behind the text
  23. 23.🧩 Which language gives the page structure? (a) CSS (b) HTML (c) JavaScript
  24. 24.What does text-align do? (a) picks the font style (b) makes letters bigger (c) centres a heading (d) sets the letter colour
  25. 25.💪 Which flexbox property spaces boxes along a row? (a) justify-content (b) display: flex (c) gap (d) align-items
  26. 26.🎯 What kind of selector is #top? (a) a class selector (b) an id selector (c) an element selector
  27. 27.✍️ What value is given to font-style in this rule?
    p {
      font-style: italic;
      padding: 8px;
    }
    (a) red (b) 20px (c) italic (d) font-style
  28. 28.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 14px;
      }
    }
  29. 29.🖌️ Where does the text sit on its line?
    li {
      background-color: green;
      text-align: left;
      font-size: 32px;
      color: purple;
    }
    (a) on the right (b) on the left (c) in the middle
  30. 30.📦 In the box model, which part is the gap to other boxes? (a) padding (b) content (c) border (d) margin
  31. 31.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 150px;
      padding: 15px;
      border: 1px solid black;
      margin: 20px;
    }
  32. 32.⚖️ What colour is the text of this element?
    <h1 class="note" id="logo">Hi</h1>
    CSS:
    h1 { color: red; }
    h1 { color: white; }
    (a) blue (b) white (c) green (d) red
  33. 33.Which of these does CSS do? (a) rounds box corners (b) makes a link (c) changes the page live (d) reacts to a button click
  34. 34.✍️ Which property is set to 20px in this rule?
    .box {
      font-size: 20px;
      border: 2px solid;
      margin: 10px;
      background-color: yellow;
    }
    (a) background-color (b) font-size (c) text-align (d) 20px
  35. 35.🌈 Which hex code is bright green? (a) #0000ff (b) #00ffff (c) #ffff00 (d) #00ff00
  36. 36.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 140px;
      padding: 25px;
      border: 2px solid black;
      margin: 20px;
    }
  37. 37.🧩 Which language shows a pop-up message? (a) JavaScript (b) HTML (c) CSS
  38. 38.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 22px;
      }
    }
  39. 39.Which of these is margin? (a) a solid or dotted edge (b) the gap to other boxes (c) space inside the border (d) the line round the box
  40. 40.✍️ Which property is set to 300px in this rule?
    h1 {
      width: 300px;
      margin: 10px;
      color: red;
    }
    (a) width (b) 300px (c) font-style (d) color

Answer key

  1. packs boxes at the end
  2. cyan
  3. black
  4. 250
  5. 4
  6. gap
  7. 8
  8. the screen width
  9. text-align
  10. 80
  11. padding
  12. 2
  13. style
  14. True
  15. HTML
  16. 10
  17. flex-direction
  18. 30
  19. <p class="red">
  20. HTML
  21. an element selector
  22. makes the text bold
  23. HTML
  24. centres a heading
  25. justify-content
  26. an id selector
  27. italic
  28. 14
  29. on the left
  30. margin
  31. 222
  32. white
  33. rounds box corners
  34. font-size
  35. #00ff00
  36. 234
  37. JavaScript
  38. 22
  39. the gap to other boxes
  40. width

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