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

Answer key

  1. { }
  2. 2
  3. color
  4. padding
  5. li
  6. 1
  7. red
  8. body
  9. font-weight
  10. red
  11. 4
  12. li
  13. color
  14. 1
  15. p
  16. ;
  17. bold
  18. margin
  19. 1
  20. p
  21. 1
  22. 1
  23. /*
  24. font-weight
  25. margin
  26. :
  27. 10px
  28. 3
  29. font-style
  30. red
  31. body
  32. 4
  33. color
  34. 4
  35. yellow
  36. background-color
  37. 3
  38. 2
  39. 8px
  40. padding

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