← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 978 · 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 sign goes between a property and its value? (a) - (b) ; (c) = (d) :
  2. 2.✍️ Which property is set to center in this rule?
    h1 {
      font-weight: bold;
      margin: 10px;
      text-align: center;
    }
    (a) margin (b) text-align (c) background-color (d) center
  3. 3.🖌️ Where does the text sit on its line?
    p {
      background-color: purple;
      color: white;
      text-align: right;
      font-size: 40px;
    }
    (a) in the middle (b) on the left (c) on the right
  4. 4.🖌️ Which CSS property sets the letter colour? (a) background-color (b) font-weight (c) text-align (d) color
  5. 5.🌈 In #2f0000 the red part is the hex number 2f. What is it as a normal number?
  6. 6.✍️ In color: blue; which part is the value? (a) : (b) color (c) ; (d) blue
  7. 7.🧩 Which language gives the page structure? (a) JavaScript (b) CSS (c) HTML
  8. 8.✍️ What value is given to text-align in this rule?
    .box {
      background-color: yellow;
      text-align: center;
      border: 2px solid;
    }
    (a) text-align (b) yellow (c) center (d) 10px
  9. 9.True or false: #hero is an id selector. (a) False (b) True
  10. 10.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 300px;
      padding: 10px;
      border: 3px solid black;
      margin: 20px;
    }
  11. 11.✍️ What value is given to color in this rule?
    h1 {
      font-weight: bold;
      font-size: 20px;
      color: red;
    }
    (a) center (b) color (c) red (d) 20px
  12. 12.✍️ What is the selector in this CSS rule?
    body {
      padding: 8px;
      border: 2px solid;
    }
    (a) body (b) 2px solid (c) padding (d) .box
  13. 13.🧩 Which language makes a link? (a) JavaScript (b) CSS (c) HTML
  14. 14.Which of these does CSS do? (a) changes the text size (b) makes a link (c) checks a quiz answer (d) gives the page structure
  15. 15.🧩 Which language checks a quiz answer? (a) CSS (b) HTML (c) JavaScript
  16. 16.True or false: JavaScript puts a picture on a page. (a) False (b) True
  17. 17.🌈 Which hex code is blue? (a) #000000 (b) #00ff00 (c) #ff00ff (d) #0000ff
  18. 18.📱 What does a media query check? (a) the page title (b) the battery level (c) the time of day (d) the screen width
  19. 19.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 90px;
      padding: 30px;
      border: 1px solid black;
      margin: 5px;
    }
  20. 20.🌈 Which hex code is magenta? (a) #ff0000 (b) #00ff00 (c) #ffffff (d) #ff00ff
  21. 21.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 400px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 80px wide (no margins).
  22. 22.True or false: the content is a solid or dotted edge. (a) True (b) False
  23. 23.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 290px;
      padding: 5px;
      border: 5px solid black;
      margin: 20px;
    }
  24. 24.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 8px;
      }
    }
    (a) No (b) Yes
  25. 25.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 30px;
      }
    }
  26. 26.💪 Which flexbox property sets space between boxes? (a) flex-direction (b) gap (c) align-items (d) display: flex
  27. 27.✍️ What value is given to text-align in this rule?
    p {
      color: red;
      background-color: yellow;
      text-align: center;
    }
    (a) text-align (b) center (c) 10px (d) yellow
  28. 28.🖌️ How big is the text, in px?
    li {
      background-color: black;
      color: purple;
      font-size: 28px;
      text-align: left;
    }
  29. 29.🌈 Which colour of light is strongest in rgb(123, 71, 202)? (a) red (b) blue (c) green
  30. 30.✍️ What is the selector in this CSS rule?
    .box {
      background-color: yellow;
      font-size: 20px;
    }
    (a) h2 (b) 20px (c) background-color (d) .box
  31. 31.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 280px;
      justify-content: center;
    }
    Inside are 4 boxes, each 60px wide (no margins).
  32. 32.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 20px;
      }
    }
  33. 33.🌈 Which colour of light is strongest in rgb(249, 70, 68)? (a) blue (b) green (c) red
  34. 34.🔍 Which is the odd one out? (a) counts down a timer (b) changes the text size (c) sets colours and fonts (d) adds space around boxes
  35. 35.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 90px;
      padding: 10px;
      border: 1px solid black;
      margin: 5px;
    }
  36. 36.Which of these does HTML do? (a) gives the page structure (b) changes the text size (c) checks a quiz answer (d) rounds box corners
  37. 37.True or false: HTML makes a link. (a) True (b) False
  38. 38.🖌️ Which CSS property picks the font style? (a) color (b) background-color (c) font-weight (d) font-family
  39. 39.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 2 (b) 3 (c) 6 (d) 4
  40. 40.✍️ What value is given to color in this rule?
    .box {
      margin: 10px;
      color: red;
    }
    (a) center (b) color (c) red (d) 20px

Answer key

  1. :
  2. text-align
  3. on the right
  4. color
  5. 47
  6. blue
  7. HTML
  8. center
  9. True
  10. 366
  11. red
  12. body
  13. HTML
  14. changes the text size
  15. JavaScript
  16. False
  17. #0000ff
  18. the screen width
  19. 152
  20. #ff00ff
  21. 80
  22. False
  23. 310
  24. No
  25. 24
  26. gap
  27. center
  28. 28
  29. blue
  30. .box
  31. 20
  32. 20
  33. red
  34. counts down a timer
  35. 122
  36. gives the page structure
  37. True
  38. font-family
  39. 3
  40. red

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