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

Answer key

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

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