← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 389 · 40 questions
TalentJR

Code tip (Rule, then maths): Find the topic: syntax, selectors, properties, colours, box model, cascade, flexbox or media queries. Decide which rule or property applies to the element. For sizes, write the sum down: both sides for the box model, free space for flexbox.

NameDateTime takenScore ___ / 40
  1. 1.True or false: JavaScript makes a link. (a) False (b) True
  2. 2.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 180px;
      padding: 30px;
      border: 1px solid black;
      margin: 0px;
    }
  3. 3.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 6px;
      }
    }
  4. 4.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 12px;
      }
    }
    (a) No (b) Yes
  5. 5.🎯 Which CSS selector matches this element?
    <h2 class="big" id="end">Hello</h2>
    (a) #big (b) li (c) .big (d) .red
  6. 6.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 160px;
      padding: 25px;
      border: 1px solid black;
      margin: 5px;
    }
  7. 7.📦 In the box model, which part is a solid or dotted edge? (a) content (b) padding (c) margin (d) border
  8. 8.True or false: #top is an element selector. (a) True (b) False
  9. 9.✍️ What value is given to font-weight in this rule?
    h1 {
      text-align: center;
      color: red;
      font-weight: bold;
    }
    (a) font-weight (b) 2px solid (c) bold (d) 300px
  10. 10.🎯 Which element does the selector .star style? (a) <h1 class="star"> (b) <h2 class="note"> (c) <h1 class="menu"> (d) <h1 id="star">
  11. 11.🔍 Which is the odd one out? (a) changes the text size (b) adds space around boxes (c) puts a picture on a page (d) sets colours and fonts
  12. 12.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 130px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  13. 13.✍️ Which property is set to 20px in this rule?
    .box {
      margin: 10px;
      font-size: 20px;
      font-style: italic;
    }
    (a) text-align (b) font-size (c) 20px (d) background-color
  14. 14.✍️ What is the selector in this CSS rule?
    p {
      font-size: 20px;
      text-align: center;
      width: 300px;
    }
    (a) font-size (b) p (c) .note (d) center
  15. 15.✍️ Which sign goes between a property and its value? (a) = (b) - (c) : (d) ;
  16. 16.True or false: JavaScript changes the page live. (a) True (b) False
  17. 17.✍️ What value is given to font-style in this rule?
    h2 {
      font-style: italic;
      border: 2px solid;
    }
    (a) font-style (b) 20px (c) red (d) italic
  18. 18.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 230px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  19. 19.🌈 Which colour is #ff0000? (a) red (b) yellow (c) blue (d) cyan
  20. 20.✍️ What value is given to padding in this rule?
    h1 {
      border: 2px solid;
      background-color: yellow;
      font-style: italic;
      padding: 8px;
    }
    (a) 8px (b) padding (c) 2px solid (d) bold
  21. 21.📱 The screen is 820px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 20px;
      }
    }
    (a) Yes (b) No
  22. 22.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 24px;
      }
    }
    (a) Yes (b) No
  23. 23.🌈 In #00005d the blue part is the hex number 5d. What is it as a normal number?
  24. 24.🎯 Which CSS selector matches this element?
    <p class="big" id="logo">Hello</p>
    (a) .red (b) #big (c) #logo (d) .logo
  25. 25.📱 What does a media query check? (a) the battery level (b) the page title (c) the screen width (d) the time of day
  26. 26.True or false: the border is space inside the border. (a) True (b) False
  27. 27.🖌️ What colour is behind the letters?
    li {
      text-align: right;
      color: blue;
      background-color: white;
      font-size: 12px;
    }
    (a) white (b) blue (c) green
  28. 28.✍️ What is the selector in this CSS rule?
    h2 {
      padding: 8px;
      font-style: italic;
    }
    (a) padding (b) h2 (c) italic (d) h1
  29. 29.🖌️ Which CSS property centres a heading? (a) background-color (b) font-family (c) text-align (d) font-size
  30. 30.✍️ Which sign ends each CSS declaration? (a) : (b) . (c) ; (d) ,
  31. 31.🖌️ What colour are the letters?
    h1 {
      text-align: center;
      font-size: 12px;
      background-color: blue;
      color: black;
    }
    (a) white (b) black (c) blue
  32. 32.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 14px;
      }
    }
  33. 33.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 28px;
      }
    }
    (a) Yes (b) No
  34. 34.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 24px;
      }
    }
  35. 35.🎯 What kind of selector is body? (a) a class selector (b) an id selector (c) an element selector
  36. 36.🌈 Which colour of light is strongest in rgb(53, 170, 82)? (a) green (b) red (c) blue
  37. 37.🌈 Which colour is rgb(0, 255, 0)? (a) black (b) bright green (c) white (d) blue
  38. 38.🌈 In #e10000 the red part is the hex number e1. What is it as a normal number?
  39. 39.🌈 In #1f0000 the red part is the hex number 1f. What is it as a normal number?
  40. 40.⚖️ What colour is the text of this element?
    <p class="menu" id="end">Hi</p>
    CSS:
    .menu { color: yellow; }
    .menu { color: purple; }
    (a) orange (b) purple (c) yellow (d) white

Answer key

  1. False
  2. 242
  3. 12
  4. Yes
  5. .big
  6. 222
  7. border
  8. False
  9. bold
  10. <h1 class="star">
  11. puts a picture on a page
  12. 10
  13. font-size
  14. p
  15. :
  16. True
  17. italic
  18. 70
  19. red
  20. 8px
  21. Yes
  22. No
  23. 93
  24. #logo
  25. the screen width
  26. False
  27. white
  28. h2
  29. text-align
  30. ;
  31. black
  32. 12
  33. No
  34. 20
  35. an element selector
  36. green
  37. bright green
  38. 225
  39. 31
  40. purple

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