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

Answer key

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

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