← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 819 · 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 many elements on a page should have the same id? (a) 2 (b) any number (c) 5 (d) 1
  2. 2.🖌️ Which CSS property makes letters bigger? (a) font-size (b) background-color (c) color (d) text-align
  3. 3.🎯 What kind of selector is body? (a) a class selector (b) an element selector (c) an id selector
  4. 4.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 8px;
      }
    }
    (a) No (b) Yes
  5. 5.⚖️ What colour is the text of this element?
    <h2 class="note" id="top">Hi</h2>
    CSS:
    h2 { color: blue; }
    .note { color: yellow; }
    #top { color: black; }
    (a) purple (b) black (c) blue (d) yellow
  6. 6.🎯 What kind of selector is p? (a) a class selector (b) an id selector (c) an element selector
  7. 7.True or false: HTML puts a picture on a page. (a) False (b) True
  8. 8.What does text-align do? (a) sets the letter colour (b) makes the text bold (c) centres a heading (d) picks the font style
  9. 9.⚖️ What colour is the text of this element?
    <h1 class="big" id="logo">Hi</h1>
    CSS:
    h1 { color: white; }
    h1 { color: black; }
    (a) white (b) blue (c) green (d) black
  10. 10.🧩 Which language puts a picture on a page? (a) JavaScript (b) CSS (c) HTML
  11. 11.🌈 Which colour is #00ff00? (a) black (b) white (c) bright green (d) red
  12. 12.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 12px;
      }
    }
  13. 13.✍️ Which sign ends each CSS declaration? (a) . (b) , (c) : (d) ;
  14. 14.⚖️ What colour is the text of this element?
    <h1 class="red" id="end">Hi</h1>
    CSS:
    h1 { color: green; }
    h1 { color: black; }
    (a) blue (b) green (c) red (d) black
  15. 15.🎨 Which tag holds CSS inside the head? (a) <script> (b) <body> (c) <style> (d) <css>
  16. 16.🌈 What is the biggest number one colour can have in rgb()? (a) 255 (b) 1000 (c) 99 (d) 100
  17. 17.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 14px;
      }
    }
  18. 18.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 110px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  19. 19.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      font-size: 20px;
      font-style: italic;
      font-weight: bold;
      border: 2px solid;
    }
  20. 20.🔍 Which is the odd one out? (a) makes headings and lists (b) changes the page live (c) puts a picture on a page (d) gives the page structure
  21. 21.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 32px;
      }
    }
    (a) No (b) Yes
  22. 22.💪 Which justify-content value packs boxes at the start? (a) flex-end (b) flex-start (c) center (d) space-between
  23. 23.What does color do? (a) sets the letter colour (b) colours behind the text (c) picks the font style (d) makes the text bold
  24. 24.🖌️ Which CSS property sets the letter colour? (a) text-align (b) font-weight (c) color (d) font-size
  25. 25.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 8px;
      }
    }
  26. 26.What does justify-content: flex-start do? (a) equal gaps, none at ends (b) packs boxes at the start (c) packs boxes at the end (d) puts boxes in the middle
  27. 27.📦 In the box model, which part is the text or picture? (a) content (b) margin (c) padding (d) border
  28. 28.⚖️ What colour is the text of this element?
    <h1 class="big" id="intro">Hi</h1>
    CSS:
    h1 { color: blue; }
    h1 { color: black; }
    (a) black (b) blue (c) purple (d) green
  29. 29.Which of these is the border? (a) space inside the border (b) the text or picture (c) space outside the border (d) a solid or dotted edge
  30. 30.📱 Responsive design means a page ___. (a) never changes (b) has no pictures (c) fits every screen (d) is only for laptops
  31. 31.💪 Which justify-content value equal gaps, none at ends? (a) flex-end (b) space-between (c) flex-start (d) center
  32. 32.🔍 Which is the odd one out? (a) counts down a timer (b) shows a pop-up message (c) rounds box corners (d) checks a quiz answer
  33. 33.True or false: padding is the line round the box. (a) False (b) True
  34. 34.🎨 What does CSS stand for? (a) Creative Sheet System (b) Cascading Style Sheets (c) Computer Style Sheets (d) Colourful Site Styles
  35. 35.🧩 Which language gives the page structure? (a) HTML (b) CSS (c) JavaScript
  36. 36.🎯 What kind of selector is #top? (a) an id selector (b) an element selector (c) a class selector
  37. 37.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 28px;
      }
    }
    (a) Yes (b) No
  38. 38.🌈 Which hex code is magenta? (a) #000000 (b) #0000ff (c) #ff00ff (d) #ff0000
  39. 39.🖌️ Where does the text sit on its line?
    h1 {
      font-size: 32px;
      background-color: blue;
      text-align: left;
      color: red;
    }
    (a) in the middle (b) on the right (c) on the left
  40. 40.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 22px;
      }
    }

Answer key

  1. 1
  2. font-size
  3. an element selector
  4. Yes
  5. black
  6. an element selector
  7. True
  8. centres a heading
  9. black
  10. HTML
  11. bright green
  12. 16
  13. ;
  14. black
  15. <style>
  16. 255
  17. 14
  18. 30
  19. 4
  20. changes the page live
  21. No
  22. flex-start
  23. sets the letter colour
  24. color
  25. 8
  26. packs boxes at the start
  27. content
  28. black
  29. a solid or dotted edge
  30. fits every screen
  31. space-between
  32. rounds box corners
  33. False
  34. Cascading Style Sheets
  35. HTML
  36. an id selector
  37. Yes
  38. #ff00ff
  39. on the left
  40. 22

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