← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 258 · 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.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 170px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  2. 2.✍️ What value is given to font-style in this rule?
    body {
      font-size: 20px;
      margin: 10px;
      padding: 8px;
      font-style: italic;
    }
    (a) red (b) 20px (c) font-style (d) italic
  3. 3.💪 Which flexbox property lines boxes up across? (a) align-items (b) display: flex (c) flex-direction (d) justify-content
  4. 4.🎯 How many elements on a page should have the same id? (a) 1 (b) 2 (c) 5 (d) any number
  5. 5.📱 What does a media query check? (a) the battery level (b) the time of day (c) the page title (d) the screen width
  6. 6.🌈 Which colour is rgb(0, 0, 255)? (a) blue (b) yellow (c) magenta (d) cyan
  7. 7.✍️ In color: blue; which part is the property? (a) blue (b) : (c) color (d) ;
  8. 8.True or false: CSS gives the page structure. (a) True (b) False
  9. 9.✍️ What is the selector in this CSS rule?
    .box {
      color: red;
      margin: 10px;
    }
    (a) 10px (b) color (c) .box (d) h2
  10. 10.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 6px;
      }
    }
  11. 11.Which of these does HTML do? (a) counts down a timer (b) shows a pop-up message (c) makes headings and lists (d) lays out the page
  12. 12.🌈 In #008500 the green part is the hex number 85. What is it as a normal number?
  13. 13.📦 In the box model, which part is a solid or dotted edge? (a) padding (b) margin (c) border (d) content
  14. 14.✍️ Which sign ends each CSS declaration? (a) : (b) , (c) ; (d) .
  15. 15.🧩 Which language checks a quiz answer? (a) CSS (b) HTML (c) JavaScript
  16. 16.🎯 Can many elements share the same class? (a) Yes (b) No
  17. 17.🖌️ What colour are the letters?
    h2 {
      color: white;
      background-color: orange;
      text-align: left;
      font-size: 28px;
    }
    (a) white (b) red (c) orange
  18. 18.🖌️ What colour are the letters?
    p {
      text-align: left;
      background-color: black;
      font-size: 16px;
      color: orange;
    }
    (a) orange (b) red (c) black
  19. 19.🌈 Which colour is #ffffff? (a) cyan (b) bright green (c) white (d) magenta
  20. 20.🎯 Which sign starts an id selector? (a) . (b) @ (c) & (d) #
  21. 21.🌈 In #610000 the red part is the hex number 61. What is it as a normal number?
  22. 22.🖌️ What colour are the letters?
    li {
      font-size: 12px;
      background-color: black;
      text-align: left;
      color: blue;
    }
    (a) black (b) red (c) blue
  23. 23.🎯 Which CSS selector matches this element?
    <h1 class="big" id="main">Hello</h1>
    (a) .red (b) #logo (c) #big (d) #main
  24. 24.🌈 Which hex code is white? (a) #000000 (b) #00ffff (c) #ff0000 (d) #ffffff
  25. 25.✍️ Which property is set to bold in this rule?
    body {
      font-weight: bold;
      border: 2px solid;
      width: 300px;
    }
    (a) border (b) width (c) font-weight (d) bold
  26. 26.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 500px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 80px wide (no margins).
  27. 27.✍️ What value is given to font-weight in this rule?
    p {
      margin: 10px;
      font-weight: bold;
      font-size: 20px;
      padding: 8px;
    }
    (a) font-weight (b) 300px (c) bold (d) 2px solid
  28. 28.✍️ How many declarations (property: value pairs) are in this rule?
    #top {
      padding: 8px;
      font-style: italic;
      margin: 10px;
      width: 300px;
    }
  29. 29.🖌️ What colour is behind the letters?
    li {
      color: orange;
      background-color: yellow;
      font-size: 36px;
      text-align: left;
    }
    (a) yellow (b) green (c) orange
  30. 30.🖌️ Which CSS property makes the text bold? (a) color (b) text-align (c) background-color (d) font-weight
  31. 31.✍️ How does a CSS comment start? (a) # (b) <!-- (c) // (d) /*
  32. 32.True or false: CSS changes the text size. (a) True (b) False
  33. 33.🎯 Which CSS selector matches this element?
    <div class="star" id="top">Hello</div>
    (a) #top (b) #intro (c) .menu (d) .top
  34. 34.🖌️ What colour is behind the letters?
    h2 {
      color: yellow;
      background-color: orange;
      text-align: left;
      font-size: 20px;
    }
    (a) red (b) yellow (c) orange
  35. 35.⚖️ What colour is the text of this element?
    <h2 class="note" id="top">Hi</h2>
    CSS:
    .note { color: green; }
    .note { color: purple; }
    (a) green (b) blue (c) yellow (d) purple
  36. 36.🧩 Which language gives the page structure? (a) HTML (b) JavaScript (c) CSS
  37. 37.📱 Responsive design means a page ___. (a) has no pictures (b) never changes (c) is only for laptops (d) fits every screen
  38. 38.🧩 Which language makes headings and lists? (a) HTML (b) CSS (c) JavaScript
  39. 39.⚖️ What colour is the text of this element?
    <h1 class="red" id="intro">Hi</h1>
    CSS:
    .red { color: yellow; }
    .red { color: green; }
    (a) green (b) yellow (c) purple (d) black
  40. 40.🌈 In #rrggbb, which colour do the first two digits give? (a) black (b) green (c) blue (d) red

Answer key

  1. 10
  2. italic
  3. align-items
  4. 1
  5. the screen width
  6. blue
  7. color
  8. False
  9. .box
  10. 12
  11. makes headings and lists
  12. 133
  13. border
  14. ;
  15. JavaScript
  16. Yes
  17. white
  18. orange
  19. white
  20. #
  21. 97
  22. blue
  23. #main
  24. #ffffff
  25. font-weight
  26. 60
  27. bold
  28. 4
  29. yellow
  30. font-weight
  31. /*
  32. True
  33. #top
  34. orange
  35. purple
  36. HTML
  37. fits every screen
  38. HTML
  39. green
  40. red

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