← CSS rules: selector, property, value lesson New set →

CSS Worksheet: CSS Rules and Syntax

HTML and CSS lesson 12: CSS rules: selector, property, value · Set 524 · 40 questions
TalentJR

Code tip (Colon in the middle, semicolon at the end): A rule is: selector { property: value; property: value; } The property is before the colon, the value after it; a semicolon ends each declaration. Count the property: value; lines to count the declarations.

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 italic in this rule?
    #top {
      color: red;
      font-style: italic;
    }
    (a) italic (b) font-size (c) color (d) font-style
  3. 3.✍️ What is the selector in this CSS rule?
    p {
      margin: 10px;
      background-color: yellow;
    }
    (a) p (b) .note (c) yellow (d) margin
  4. 4.✍️ Which property is set to italic in this rule?
    li {
      font-style: italic;
      text-align: center;
      color: red;
      background-color: yellow;
    }
    (a) italic (b) font-size (c) color (d) font-style
  5. 5.✍️ In color: blue; which part is the property? (a) ; (b) blue (c) : (d) color
  6. 6.✍️ In color: blue; which part is the value? (a) ; (b) : (c) blue (d) color
  7. 7.✍️ Which property is set to 300px in this rule?
    body {
      width: 300px;
      background-color: yellow;
      margin: 10px;
    }
    (a) font-style (b) color (c) 300px (d) width
  8. 8.✍️ What is the selector in this CSS rule?
    h2 {
      font-size: 20px;
      background-color: yellow;
      margin: 10px;
    }
    (a) font-size (b) h2 (c) h1 (d) yellow
  9. 9.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      background-color: yellow;
    }
  10. 10.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      font-weight: bold;
      width: 300px;
      font-size: 20px;
      color: red;
    }
  11. 11.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      font-weight: bold;
    }
  12. 12.✍️ What is the selector in this CSS rule?
    li {
      background-color: yellow;
      text-align: center;
      padding: 8px;
      font-weight: bold;
    }
    (a) li (b) background-color (c) center (d) body
  13. 13.✍️ Which property is set to 300px in this rule?
    .note {
      width: 300px;
      font-style: italic;
    }
    (a) color (b) 300px (c) width (d) font-style
  14. 14.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      border: 2px solid;
    }
  15. 15.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      font-weight: bold;
      margin: 10px;
      color: red;
      border: 2px solid;
    }
  16. 16.✍️ Which sign ends each CSS declaration? (a) , (b) ; (c) . (d) :
  17. 17.✍️ Which property is set to 300px in this rule?
    h1 {
      width: 300px;
      color: red;
      border: 2px solid;
      font-size: 20px;
    }
    (a) color (b) width (c) 300px (d) font-style
  18. 18.✍️ Which property is set to 10px in this rule?
    p {
      border: 2px solid;
      margin: 10px;
      font-size: 20px;
    }
    (a) 10px (b) padding (c) font-weight (d) margin
  19. 19.✍️ How many declarations (property: value pairs) are in this rule?
    .box {
      margin: 10px;
    }
  20. 20.✍️ What value is given to border in this rule?
    li {
      padding: 8px;
      margin: 10px;
      border: 2px solid;
    }
    (a) 2px solid (b) italic (c) 300px (d) border
  21. 21.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      text-align: center;
      font-weight: bold;
      background-color: yellow;
      font-style: italic;
    }
  22. 22.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      font-size: 20px;
    }
  23. 23.✍️ Which property is set to center in this rule?
    li {
      margin: 10px;
      text-align: center;
    }
    (a) background-color (b) margin (c) text-align (d) center
  24. 24.✍️ CSS declarations go inside which brackets? (a) [ ] (b) ( ) (c) { } (d) < >
  25. 25.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      text-align: center;
    }
  26. 26.✍️ What value is given to border in this rule?
    body {
      font-style: italic;
      padding: 8px;
      border: 2px solid;
      width: 300px;
    }
    (a) 2px solid (b) border (c) 300px (d) italic
  27. 27.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      color: red;
    }
  28. 28.✍️ Which property is set to italic in this rule?
    #top {
      font-style: italic;
      border: 2px solid;
      font-weight: bold;
    }
    (a) color (b) font-size (c) font-style (d) italic
  29. 29.✍️ How many declarations (property: value pairs) are in this rule?
    body {
      color: red;
      width: 300px;
      background-color: yellow;
      text-align: center;
    }
  30. 30.✍️ What is the selector in this CSS rule?
    li {
      padding: 8px;
      margin: 10px;
    }
    (a) body (b) padding (c) li (d) 10px
  31. 31.✍️ How does a CSS comment start? (a) # (b) /* (c) <!-- (d) //
  32. 32.✍️ What value is given to padding in this rule?
    p {
      text-align: center;
      font-style: italic;
      padding: 8px;
      font-weight: bold;
    }
    (a) bold (b) 8px (c) 2px solid (d) padding
  33. 33.✍️ What is the selector in this CSS rule?
    .note {
      margin: 10px;
      font-style: italic;
    }
    (a) .note (b) margin (c) #top (d) italic
  34. 34.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      font-size: 20px;
      margin: 10px;
    }
  35. 35.✍️ How many declarations (property: value pairs) are in this rule?
    #top {
      color: red;
    }
  36. 36.✍️ How many declarations (property: value pairs) are in this rule?
    body {
      background-color: yellow;
    }
  37. 37.✍️ Which property is set to 2px solid in this rule?
    .note {
      width: 300px;
      font-weight: bold;
      border: 2px solid;
    }
    (a) font-style (b) width (c) border (d) 2px solid
  38. 38.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      background-color: yellow;
      font-size: 20px;
    }
  39. 39.✍️ What is the selector in this CSS rule?
    li {
      font-size: 20px;
      margin: 10px;
      background-color: yellow;
    }
    (a) 10px (b) li (c) font-size (d) body
  40. 40.✍️ What is the selector in this CSS rule?
    li {
      text-align: center;
      font-weight: bold;
      font-style: italic;
    }
    (a) body (b) bold (c) li (d) text-align

Answer key

  1. :
  2. font-style
  3. p
  4. font-style
  5. color
  6. blue
  7. width
  8. h2
  9. 1
  10. 4
  11. 1
  12. li
  13. width
  14. 1
  15. 4
  16. ;
  17. width
  18. margin
  19. 1
  20. 2px solid
  21. 4
  22. 1
  23. text-align
  24. { }
  25. 1
  26. 2px solid
  27. 1
  28. font-style
  29. 4
  30. li
  31. /*
  32. 8px
  33. .note
  34. 2
  35. 1
  36. 1
  37. border
  38. 2
  39. li
  40. li

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