← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 622 · 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.✍️ What value is given to margin in this rule?
    .box {
      font-size: 20px;
      border: 2px solid;
      margin: 10px;
    }
    (a) 8px (b) 10px (c) margin (d) bold
  2. 2.✍️ Which property is set to red in this rule?
    .note {
      color: red;
      background-color: yellow;
    }
    (a) color (b) red (c) font-size (d) text-align
  3. 3.True or false: margin is the gap to other boxes. (a) True (b) False
  4. 4.✍️ CSS declarations go inside which brackets? (a) { } (b) ( ) (c) < > (d) [ ]
  5. 5.Which of these does CSS do? (a) makes headings and lists (b) lays out the page (c) reacts to a button click (d) gives the page structure
  6. 6.📱 What does a media query check? (a) the battery level (b) the page title (c) the time of day (d) the screen width
  7. 7.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 24px;
      }
    }
  8. 8.True or false: the content is the text or picture. (a) True (b) False
  9. 9.🎯 Which element does the selector p style? (a) <li id="end"> (b) <h1> (c) <h2 class="big"> (d) <p class="big">
  10. 10.What does font-size do? (a) colours behind the text (b) makes letters bigger (c) sets the letter colour (d) centres a heading
  11. 11.🖌️ Where does the text sit on its line?
    h1 {
      text-align: center;
      color: blue;
      background-color: red;
      font-size: 20px;
    }
    (a) on the left (b) on the right (c) in the middle
  12. 12.🌈 Which colour of light is strongest in rgb(134, 173, 8)? (a) green (b) blue (c) red
  13. 13.💪 Which flexbox property turns on flexbox? (a) align-items (b) display: flex (c) justify-content (d) flex-direction
  14. 14.🖌️ What colour are the letters?
    li {
      text-align: center;
      color: blue;
      background-color: purple;
      font-size: 16px;
    }
    (a) green (b) blue (c) purple
  15. 15.True or false: padding is space inside the border. (a) True (b) False
  16. 16.What does justify-content: flex-start do? (a) equal gaps, none at ends (b) packs boxes at the start (c) puts boxes in the middle (d) packs boxes at the end
  17. 17.What does font-family do? (a) picks the font style (b) centres a heading (c) makes letters bigger (d) colours behind the text
  18. 18.🖌️ Which CSS property picks the font style? (a) font-weight (b) font-family (c) text-align (d) font-size
  19. 19.✍️ What value is given to text-align in this rule?
    h1 {
      padding: 8px;
      margin: 10px;
      text-align: center;
      color: red;
    }
    (a) center (b) 10px (c) text-align (d) yellow
  20. 20.True or false: CSS lays out the page. (a) False (b) True
  21. 21.🎨 Which tag holds CSS inside the head? (a) <style> (b) <script> (c) <css> (d) <body>
  22. 22.True or false: the border is a solid or dotted edge. (a) False (b) True
  23. 23.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 50px;
      padding: 25px;
      border: 4px solid black;
      margin: 20px;
    }
  24. 24.✍️ In color: blue; which part is the value? (a) ; (b) blue (c) color (d) :
  25. 25.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 300px;
      justify-content: space-between;
    }
    Inside are 3 boxes, each 60px wide (no margins).
  26. 26.💪 Which justify-content value packs boxes at the end? (a) space-between (b) flex-start (c) center (d) flex-end
  27. 27.📦 In the box model, which part is the line round the box? (a) padding (b) margin (c) border (d) content
  28. 28.🎯 Which element does the selector #intro style? (a) <span class="intro"> (b) <span id="intro"> (c) <p class="menu"> (d) <span id="main">
  29. 29.⚖️ What colour is the text of this element?
    <h2 class="menu" id="top">Hi</h2>
    CSS:
    .menu { color: yellow; }
    #top { color: orange; }
    h2 { color: purple; }
    (a) orange (b) yellow (c) purple (d) black
  30. 30.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 4 (b) 3 (c) 2 (d) 6
  31. 31.🌈 In #000083 the blue part is the hex number 83. What is it as a normal number?
  32. 32.🎯 What kind of selector is .big? (a) an id selector (b) a class selector (c) an element selector
  33. 33.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 16px;
      }
    }
    (a) Yes (b) No
  34. 34.🖌️ How big is the text, in px?
    h1 {
      background-color: blue;
      text-align: center;
      font-size: 20px;
      color: white;
    }
  35. 35.🌈 In #rrggbb, which colour do the first two digits give? (a) blue (b) red (c) green (d) black
  36. 36.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 240px;
      padding: 10px;
      border: 3px solid black;
      margin: 20px;
    }
  37. 37.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 290px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 60px wide (no margins).
  38. 38.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 200px;
      justify-content: flex-end;
    }
    Inside are 3 boxes, each 40px wide (no margins).
  39. 39.🖌️ What colour are the letters?
    h2 {
      color: orange;
      background-color: black;
      font-size: 36px;
      text-align: right;
    }
    (a) green (b) black (c) orange
  40. 40.What does background-color do? (a) makes letters bigger (b) colours behind the text (c) picks the font style (d) centres a heading

Answer key

  1. 10px
  2. color
  3. True
  4. { }
  5. lays out the page
  6. the screen width
  7. 16
  8. True
  9. <p class="big">
  10. makes letters bigger
  11. in the middle
  12. green
  13. display: flex
  14. blue
  15. True
  16. packs boxes at the start
  17. picks the font style
  18. font-family
  19. center
  20. True
  21. <style>
  22. True
  23. 148
  24. blue
  25. 60
  26. flex-end
  27. border
  28. <span id="intro">
  29. orange
  30. 3
  31. 131
  32. a class selector
  33. No
  34. 20
  35. red
  36. 266
  37. 50
  38. 80
  39. orange
  40. colours behind the text

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