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

Answer key

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

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