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

Answer key

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

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