← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 421 · 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.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 26px;
      }
    }
  2. 2.💪 Which justify-content value packs boxes at the start? (a) space-between (b) center (c) flex-start (d) flex-end
  3. 3.✍️ CSS declarations go inside which brackets? (a) ( ) (b) [ ] (c) { } (d) < >
  4. 4.🖌️ Which CSS property picks the font style? (a) font-family (b) text-align (c) font-size (d) background-color
  5. 5.📱 The screen is 820px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 12px;
      }
    }
    (a) No (b) Yes
  6. 6.🌈 Which colour is rgb(0, 0, 255)? (a) cyan (b) yellow (c) white (d) blue
  7. 7.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 150px;
      padding: 15px;
      border: 2px solid black;
      margin: 10px;
    }
  8. 8.True or false: the content is space outside the border. (a) False (b) True
  9. 9.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 18px;
      }
    }
    (a) No (b) Yes
  10. 10.📱 What does a media query check? (a) the time of day (b) the battery level (c) the screen width (d) the page title
  11. 11.✍️ In color: blue; which part is the value? (a) color (b) ; (c) blue (d) :
  12. 12.What does justify-content: space-between 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
  13. 13.💪 Which flexbox property lines boxes up across? (a) align-items (b) justify-content (c) display: flex (d) flex-direction
  14. 14.⚖️ Which selector is the weakest? (a) a class selector (b) an element selector (c) an id selector
  15. 15.🌈 Which colour is #00ff00? (a) cyan (b) bright green (c) white (d) magenta
  16. 16.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 6px;
      }
    }
  17. 17.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 30px;
      }
    }
  18. 18.Which of these does CSS do? (a) adds space around boxes (b) makes a form box (c) checks a quiz answer (d) makes headings and lists
  19. 19.🌈 Which colour is #0000ff? (a) red (b) bright green (c) black (d) blue
  20. 20.🧩 Which language changes the text size? (a) JavaScript (b) HTML (c) CSS
  21. 21.🖌️ How big is the text, in px?
    p {
      font-size: 32px;
      text-align: left;
      background-color: black;
      color: red;
    }
  22. 22.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 20px;
      }
    }
    (a) Yes (b) No
  23. 23.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 2 (b) 4 (c) 6 (d) 3
  24. 24.⚖️ Which selector is the strongest? (a) a class selector (b) an element selector (c) an id selector
  25. 25.📦 In the box model, which part is the gap round content? (a) margin (b) content (c) padding (d) border
  26. 26.🎯 What kind of selector is .note? (a) a class selector (b) an id selector (c) an element selector
  27. 27.🖌️ Which CSS property sets the letter colour? (a) color (b) text-align (c) font-weight (d) background-color
  28. 28.Which of these is the content? (a) the text or picture (b) a solid or dotted edge (c) space outside the border (d) the gap round content
  29. 29.⚖️ What colour is the text of this element?
    <p class="menu" id="intro">Hi</p>
    CSS:
    .menu { color: black; }
    #intro { color: white; }
    p { color: orange; }
    (a) white (b) yellow (c) black (d) orange
  30. 30.🌈 Which hex code is red? (a) #ff0000 (b) #000000 (c) #ffffff (d) #ffff00
  31. 31.🎯 What kind of selector is p? (a) an id selector (b) an element selector (c) a class selector
  32. 32.💪 Which flexbox property picks row or column? (a) align-items (b) display: flex (c) gap (d) flex-direction
  33. 33.🌈 Which hex code is bright green? (a) #ff0000 (b) #00ff00 (c) #ff00ff (d) #ffff00
  34. 34.✍️ What value is given to font-style in this rule?
    #top {
      margin: 10px;
      font-size: 20px;
      font-style: italic;
    }
    (a) red (b) font-style (c) italic (d) 20px
  35. 35.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 80px;
      padding: 30px;
      border: 5px solid black;
      margin: 5px;
    }
  36. 36.🎯 Which CSS selector matches this element?
    <h1 class="box" id="end">Hello</h1>
    (a) h1 (b) .end (c) .star (d) h2
  37. 37.📱 min-width: 800px applies when the screen is ___. (a) exactly 100px (b) 800px or narrower (c) 800px or wider (d) turned off
  38. 38.🔍 Which is the odd one out? (a) makes headings and lists (b) checks a quiz answer (c) changes the page live (d) shows a pop-up message
  39. 39.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 460px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 100px wide (no margins).
  40. 40.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 180px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 80px wide (no margins).

Answer key

  1. 24
  2. flex-start
  3. { }
  4. font-family
  5. Yes
  6. blue
  7. 204
  8. False
  9. Yes
  10. the screen width
  11. blue
  12. equal gaps, none at ends
  13. align-items
  14. an element selector
  15. bright green
  16. 12
  17. 24
  18. adds space around boxes
  19. blue
  20. CSS
  21. 32
  22. Yes
  23. 3
  24. an id selector
  25. padding
  26. a class selector
  27. color
  28. the text or picture
  29. white
  30. #ff0000
  31. an element selector
  32. flex-direction
  33. #00ff00
  34. italic
  35. 160
  36. h1
  37. 800px or wider
  38. makes headings and lists
  39. 20
  40. 20

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