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

Answer key

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

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