← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 233 · 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.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 300px;
      padding: 10px;
      border: 1px solid black;
      margin: 15px;
    }
  2. 2.💪 Which justify-content value packs boxes at the start? (a) space-between (b) flex-start (c) center (d) flex-end
  3. 3.🌈 In #010000 the red part is the hex number 01. What is it as a normal number?
  4. 4.🎯 Which element does the selector .star style? (a) <div class="menu"> (b) <div id="star"> (c) <div class="star"> (d) <span class="note">
  5. 5.🌈 Which colour is #00ff00? (a) black (b) blue (c) red (d) bright green
  6. 6.💪 Which justify-content value packs boxes at the end? (a) space-between (b) flex-start (c) center (d) flex-end
  7. 7.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 270px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  8. 8.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 14px;
      }
    }
    (a) Yes (b) No
  9. 9.📱 What does a media query check? (a) the screen width (b) the page title (c) the time of day (d) the battery level
  10. 10.True or false: HTML changes the page live. (a) True (b) False
  11. 11.🌈 Which hex code is white? (a) #ff0000 (b) #0000ff (c) #ffffff (d) #ffff00
  12. 12.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 250px;
      padding: 30px;
      border: 4px solid black;
      margin: 20px;
    }
  13. 13.⚖️ Which selector is the weakest? (a) an element selector (b) a class selector (c) an id selector
  14. 14.💪 Which flexbox property spaces boxes along a row? (a) flex-direction (b) align-items (c) display: flex (d) justify-content
  15. 15.What does text-align do? (a) sets the letter colour (b) picks the font style (c) colours behind the text (d) centres a heading
  16. 16.✍️ Which property is set to 8px in this rule?
    .note {
      color: red;
      padding: 8px;
    }
    (a) border (b) 8px (c) padding (d) font-weight
  17. 17.🖌️ Where does the text sit on its line?
    h1 {
      text-align: right;
      font-size: 24px;
      background-color: white;
      color: green;
    }
    (a) in the middle (b) on the left (c) on the right
  18. 18.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      text-align: center;
    }
  19. 19.✍️ How many declarations (property: value pairs) are in this rule?
    body {
      background-color: yellow;
    }
  20. 20.💪 Which flexbox property picks row or column? (a) align-items (b) justify-content (c) gap (d) flex-direction
  21. 21.⚖️ What colour is the text of this element?
    <p class="red" id="intro">Hi</p>
    CSS:
    p { color: green; }
    #intro { color: orange; }
    .red { color: blue; }
    (a) blue (b) green (c) yellow (d) orange
  22. 22.🎯 Which sign starts an id selector? (a) # (b) . (c) & (d) @
  23. 23.🖌️ What colour is behind the letters?
    h1 {
      background-color: red;
      text-align: left;
      font-size: 20px;
      color: green;
    }
    (a) yellow (b) green (c) red
  24. 24.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 160px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  25. 25.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 120px;
      padding: 5px;
      border: 3px solid black;
      margin: 20px;
    }
  26. 26.📦 In the box model, which part is the text or picture? (a) padding (b) content (c) border (d) margin
  27. 27.Which of these does CSS do? (a) makes a link (b) checks a quiz answer (c) lays out the page (d) counts down a timer
  28. 28.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 560px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 80px wide (no margins).
  29. 29.✍️ CSS declarations go inside which brackets? (a) ( ) (b) < > (c) { } (d) [ ]
  30. 30.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 4 (b) 3 (c) 6 (d) 2
  31. 31.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 22px;
      }
    }
  32. 32.🔍 Which is the odd one out? (a) changes the page live (b) adds space around boxes (c) counts down a timer (d) checks a quiz answer
  33. 33.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the first one (b) the later one (c) neither (d) the shorter one
  34. 34.Which of these is margin? (a) a solid or dotted edge (b) the gap to other boxes (c) the line round the box (d) the gap round content
  35. 35.What does justify-content: flex-start do? (a) packs boxes at the end (b) packs boxes at the start (c) equal gaps, none at ends (d) puts boxes in the middle
  36. 36.True or false: the content is space outside the border. (a) True (b) False
  37. 37.🌈 Which colour is rgb(0, 0, 255)? (a) bright green (b) yellow (c) white (d) blue
  38. 38.🎯 Which element does the selector #hero style? (a) <h2 class="box"> (b) <h1 id="hero"> (c) <h1 id="top"> (d) <h1 class="hero">
  39. 39.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) exactly 100px (c) turned off (d) 800px or wider
  40. 40.✍️ Which sign goes between a property and its value? (a) : (b) - (c) ; (d) =

Answer key

  1. 322
  2. flex-start
  3. 1
  4. <div class="star">
  5. bright green
  6. flex-end
  7. 70
  8. Yes
  9. the screen width
  10. False
  11. #ffffff
  12. 318
  13. an element selector
  14. justify-content
  15. centres a heading
  16. padding
  17. on the right
  18. 1
  19. 1
  20. flex-direction
  21. orange
  22. #
  23. red
  24. 80
  25. 176
  26. content
  27. lays out the page
  28. 80
  29. { }
  30. 3
  31. 22
  32. adds space around boxes
  33. the later one
  34. the gap to other boxes
  35. packs boxes at the start
  36. False
  37. blue
  38. <h1 id="hero">
  39. 800px or wider
  40. :

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