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

Answer key

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

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