← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 277 · 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.Which of these is margin? (a) a solid or dotted edge (b) the line round the box (c) space inside the border (d) space outside the border
  2. 2.🎯 Which element does the selector .box style? (a) <span class="menu"> (b) <div class="star"> (c) <div class="box"> (d) <div id="box">
  3. 3.🌈 Which colour is #ffffff? (a) bright green (b) blue (c) cyan (d) white
  4. 4.✍️ Which sign ends each CSS declaration? (a) , (b) . (c) : (d) ;
  5. 5.💪 Which justify-content value packs boxes at the start? (a) center (b) flex-end (c) flex-start (d) space-between
  6. 6.🖌️ Which CSS property sets the letter colour? (a) text-align (b) font-family (c) color (d) font-size
  7. 7.📱 The screen is 820px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 24px;
      }
    }
    (a) No (b) Yes
  8. 8.✍️ What is the selector in this CSS rule?
    body {
      background-color: yellow;
      border: 2px solid;
    }
    (a) background-color (b) .box (c) body (d) 2px solid
  9. 9.Which of these does JavaScript do? (a) gives the page structure (b) changes the text size (c) checks a quiz answer (d) makes headings and lists
  10. 10.🖌️ Where does the text sit on its line?
    h2 {
      background-color: purple;
      font-size: 20px;
      color: yellow;
      text-align: right;
    }
    (a) on the left (b) in the middle (c) on the right
  11. 11.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 280px;
      padding: 20px;
      border: 1px solid black;
      margin: 0px;
    }
  12. 12.✍️ Which property is set to italic in this rule?
    li {
      margin: 10px;
      color: red;
      font-style: italic;
    }
    (a) color (b) font-size (c) italic (d) font-style
  13. 13.True or false: #main is an id selector. (a) True (b) False
  14. 14.What does font-weight do? (a) makes letters bigger (b) makes the text bold (c) colours behind the text (d) sets the letter colour
  15. 15.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 22px;
      }
    }
    (a) Yes (b) No
  16. 16.🎯 Which element does the selector p style? (a) <h1> (b) <p class="box"> (c) <h2 class="box"> (d) <li id="logo">
  17. 17.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 140px;
      justify-content: center;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  18. 18.🌈 Which colour of light is strongest in rgb(176, 97, 129)? (a) blue (b) green (c) red
  19. 19.🌈 In #004e00 the green part is the hex number 4e. What is it as a normal number?
  20. 20.True or false: JavaScript checks a quiz answer. (a) True (b) False
  21. 21.✍️ Which sign goes between a property and its value? (a) ; (b) = (c) - (d) :
  22. 22.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 70px;
      padding: 30px;
      border: 4px solid black;
      margin: 5px;
    }
  23. 23.🎯 Which element does the selector span style? (a) <h2 id="intro"> (b) <span class="menu"> (c) <h1 class="menu"> (d) <p>
  24. 24.True or false: li is an id selector. (a) False (b) True
  25. 25.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) 800px or wider (c) turned off (d) exactly 100px
  26. 26.🧩 Which language shows a pop-up message? (a) JavaScript (b) HTML (c) CSS
  27. 27.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      font-size: 20px;
      font-style: italic;
      border: 2px solid;
    }
  28. 28.True or false: #logo is a class selector. (a) True (b) False
  29. 29.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 14px;
      }
    }
  30. 30.🖌️ What colour are the letters?
    h2 {
      background-color: blue;
      font-size: 32px;
      text-align: right;
      color: black;
    }
    (a) purple (b) blue (c) black
  31. 31.🎨 One CSS file can style how many pages? (a) only one word (b) only one image (c) no pages (d) many pages
  32. 32.🎯 Can many elements share the same class? (a) No (b) Yes
  33. 33.What does background-color do? (a) centres a heading (b) makes the text bold (c) picks the font style (d) colours behind the text
  34. 34.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 200px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  35. 35.📱 The screen is 1366px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 14px;
      }
    }
    (a) No (b) Yes
  36. 36.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 28px;
      }
    }
    (a) No (b) Yes
  37. 37.📦 In the box model, which part is the gap to other boxes? (a) padding (b) content (c) border (d) margin
  38. 38.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 150px;
      padding: 20px;
      border: 3px solid black;
      margin: 15px;
    }
  39. 39.🎯 What kind of selector is img? (a) a class selector (b) an id selector (c) an element selector
  40. 40.✍️ Which property is set to red in this rule?
    .note {
      color: red;
      background-color: yellow;
    }
    (a) font-size (b) color (c) red (d) text-align

Answer key

  1. space outside the border
  2. <div class="box">
  3. white
  4. ;
  5. flex-start
  6. color
  7. Yes
  8. body
  9. checks a quiz answer
  10. on the right
  11. 322
  12. font-style
  13. True
  14. makes the text bold
  15. No
  16. <p class="box">
  17. 20
  18. red
  19. 78
  20. True
  21. :
  22. 138
  23. <span class="menu">
  24. False
  25. 800px or wider
  26. JavaScript
  27. 3
  28. False
  29. 12
  30. black
  31. many pages
  32. Yes
  33. colours behind the text
  34. 80
  35. No
  36. No
  37. margin
  38. 226
  39. an element selector
  40. color

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