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

Answer key

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

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