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

Answer key

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

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