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

Answer key

  1. blue
  2. margin
  3. font-weight
  4. 2
  5. font-style
  6. border
  7. font-style
  8. 8px
  9. p
  10. .note
  11. color
  12. 4
  13. li
  14. 300px
  15. #top
  16. 2
  17. italic
  18. #top
  19. ;
  20. #top
  21. 2px solid
  22. p
  23. 3
  24. font-weight
  25. .box
  26. 1
  27. red
  28. border
  29. 8px
  30. 1
  31. font-style
  32. 2
  33. color
  34. text-align
  35. .box
  36. 2
  37. body
  38. h1
  39. 8px
  40. .box

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