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

Answer key

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

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