← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 848 · 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.💪 Which justify-content value equal gaps, none at ends? (a) flex-end (b) flex-start (c) center (d) space-between
  2. 2.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 210px;
      padding: 10px;
      border: 2px solid black;
      margin: 10px;
    }
  3. 3.🧩 Which language changes the text size? (a) JavaScript (b) HTML (c) CSS
  4. 4.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 18px;
      }
    }
  5. 5.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 24px;
      }
    }
    (a) Yes (b) No
  6. 6.✍️ Which property is set to yellow in this rule?
    li {
      text-align: center;
      background-color: yellow;
    }
    (a) padding (b) background-color (c) yellow (d) margin
  7. 7.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 250px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 80px wide (no margins).
  8. 8.⚖️ What colour is the text of this element?
    <h1 class="menu" id="logo">Hi</h1>
    CSS:
    .menu { color: green; }
    .menu { color: yellow; }
    (a) green (b) orange (c) yellow (d) red
  9. 9.🌈 In #rrggbb, which colour do the last two digits give? (a) green (b) white (c) red (d) blue
  10. 10.Which of these does JavaScript do? (a) rounds box corners (b) shows a pop-up message (c) lays out the page (d) makes a form box
  11. 11.True or false: padding is the text or picture. (a) False (b) True
  12. 12.True or false: HTML makes headings and lists. (a) False (b) True
  13. 13.⚖️ What colour is the text of this element?
    <h2 class="star" id="main">Hi</h2>
    CSS:
    h2 { color: white; }
    #main { color: yellow; }
    .star { color: red; }
    (a) white (b) red (c) black (d) yellow
  14. 14.⚖️ What colour is the text of this element?
    <p class="star" id="hero">Hi</p>
    CSS:
    #hero { color: green; }
    p { color: orange; }
    (a) yellow (b) green (c) blue (d) orange
  15. 15.🖌️ What colour is behind the letters?
    h1 {
      font-size: 20px;
      color: yellow;
      background-color: orange;
      text-align: right;
    }
    (a) yellow (b) orange (c) green
  16. 16.📱 max-width: 600px applies when the screen is ___. (a) exactly 1000px (b) 600px or narrower (c) 600px or wider (d) turned off
  17. 17.📱 Responsive design means a page ___. (a) never changes (b) is only for laptops (c) fits every screen (d) has no pictures
  18. 18.True or false: the content is the line round the box. (a) True (b) False
  19. 19.🌈 Which colour is #00ffff? (a) bright green (b) blue (c) black (d) cyan
  20. 20.🧩 Which language makes headings and lists? (a) CSS (b) JavaScript (c) HTML
  21. 21.✍️ What is the selector in this CSS rule?
    h2 {
      border: 2px solid;
      width: 300px;
    }
    (a) border (b) h1 (c) 300px (d) h2
  22. 22.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 24px;
      }
    }
  23. 23.What does font-weight do? (a) makes letters bigger (b) centres a heading (c) picks the font style (d) makes the text bold
  24. 24.What does justify-content: flex-start do? (a) packs boxes at the end (b) packs boxes at the start (c) puts boxes in the middle (d) equal gaps, none at ends
  25. 25.🎯 Which element does the selector h1 style? (a) <li class="red"> (b) <h2> (c) <div id="hero"> (d) <h1 class="red">
  26. 26.What does font-size do? (a) sets the letter colour (b) makes the text bold (c) makes letters bigger (d) centres a heading
  27. 27.🌈 In #210000 the red part is the hex number 21. What is it as a normal number?
  28. 28.⚖️ Two rules with the same selector set a colour. Which one wins? (a) neither (b) the first one (c) the shorter one (d) the later one
  29. 29.🖌️ What colour is behind the letters?
    h2 {
      background-color: orange;
      color: black;
      font-size: 24px;
      text-align: right;
    }
    (a) blue (b) orange (c) black
  30. 30.💪 Which flexbox property picks row or column? (a) justify-content (b) flex-direction (c) align-items (d) display: flex
  31. 31.🌈 In #00009d the blue part is the hex number 9d. What is it as a normal number?
  32. 32.🎨 What does CSS stand for? (a) Colourful Site Styles (b) Cascading Style Sheets (c) Creative Sheet System (d) Computer Style Sheets
  33. 33.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 190px;
      padding: 5px;
      border: 2px solid black;
      margin: 10px;
    }
  34. 34.🖌️ Which CSS property colours behind the text? (a) color (b) background-color (c) font-weight (d) font-size
  35. 35.✍️ In color: blue; which part is the property? (a) ; (b) color (c) : (d) blue
  36. 36.🔍 Which is the odd one out? (a) changes the page live (b) gives the page structure (c) shows a pop-up message (d) checks a quiz answer
  37. 37.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 150px;
      padding: 15px;
      border: 3px solid black;
      margin: 20px;
    }
  38. 38.✍️ Which sign ends each CSS declaration? (a) . (b) , (c) : (d) ;
  39. 39.⚖️ What colour is the text of this element?
    <h1 class="note" id="end">Hi</h1>
    CSS:
    #end { color: green; }
    #end { color: purple; }
    (a) yellow (b) blue (c) green (d) purple
  40. 40.🖌️ Which CSS property makes letters bigger? (a) font-size (b) text-align (c) background-color (d) font-family

Answer key

  1. space-between
  2. 254
  3. CSS
  4. 24
  5. No
  6. background-color
  7. 10
  8. yellow
  9. blue
  10. shows a pop-up message
  11. False
  12. True
  13. yellow
  14. green
  15. orange
  16. 600px or narrower
  17. fits every screen
  18. False
  19. cyan
  20. HTML
  21. h2
  22. 24
  23. makes the text bold
  24. packs boxes at the start
  25. <h1 class="red">
  26. makes letters bigger
  27. 33
  28. the later one
  29. orange
  30. flex-direction
  31. 157
  32. Cascading Style Sheets
  33. 224
  34. background-color
  35. color
  36. gives the page structure
  37. 186
  38. ;
  39. purple
  40. font-size

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