← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 538 · 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.✍️ CSS declarations go inside which brackets? (a) ( ) (b) { } (c) < > (d) [ ]
  2. 2.Which of these does HTML do? (a) rounds box corners (b) sets colours and fonts (c) puts a picture on a page (d) adds space around boxes
  3. 3.💪 Which justify-content value packs boxes at the end? (a) flex-start (b) center (c) flex-end (d) space-between
  4. 4.🌈 Which colour of light is strongest in rgb(21, 17, 244)? (a) red (b) blue (c) green
  5. 5.🎯 Which element does the selector #logo style? (a) <h2 class="logo"> (b) <h2 id="end"> (c) <h2 id="logo"> (d) <li class="note">
  6. 6.Which of these is padding? (a) the text or picture (b) the gap round content (c) the line round the box (d) a solid or dotted edge
  7. 7.🎯 How many elements on a page should have the same id? (a) 1 (b) any number (c) 5 (d) 2
  8. 8.🌈 In #00c100 the green part is the hex number c1. What is it as a normal number?
  9. 9.🖌️ How big is the text, in px?
    p {
      text-align: left;
      background-color: white;
      color: red;
      font-size: 40px;
    }
  10. 10.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 230px;
      justify-content: flex-end;
    }
    Inside are 3 boxes, each 50px wide (no margins).
  11. 11.🌈 Which colour is #ffffff? (a) blue (b) cyan (c) red (d) white
  12. 12.🔍 Which is the odd one out? (a) lays out the page (b) rounds box corners (c) changes the page live (d) sets colours and fonts
  13. 13.🌈 In #rrggbb, which colour do the first two digits give? (a) blue (b) black (c) green (d) red
  14. 14.🎯 Which CSS selector matches this element?
    <li class="big" id="logo">Hello</li>
    (a) #logo (b) #big (c) .red (d) div
  15. 15.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 40px;
      padding: 25px;
      border: 3px solid black;
      margin: 5px;
    }
  16. 16.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 8px;
      }
    }
  17. 17.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 70px;
      padding: 15px;
      border: 5px solid black;
      margin: 5px;
    }
  18. 18.🎯 Which element does the selector #end style? (a) <p id="hero"> (b) <h1 class="menu"> (c) <p class="end"> (d) <p id="end">
  19. 19.🖌️ Which CSS property sets the letter colour? (a) background-color (b) color (c) font-size (d) font-weight
  20. 20.🎯 What kind of selector is #hero? (a) an element selector (b) a class selector (c) an id selector
  21. 21.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 14px;
      }
    }
    (a) Yes (b) No
  22. 22.💪 Which justify-content value packs boxes at the start? (a) space-between (b) flex-start (c) center (d) flex-end
  23. 23.🔍 Which is the odd one out? (a) gives the page structure (b) makes headings and lists (c) makes a link (d) shows a pop-up message
  24. 24.✍️ In color: blue; which part is the value? (a) : (b) blue (c) ; (d) color
  25. 25.🎨 Which tag connects an outside CSS file? (a) <css> (b) <img> (c) <a> (d) <link>
  26. 26.✍️ Which property is set to 20px in this rule?
    p {
      font-size: 20px;
      font-style: italic;
      background-color: yellow;
      width: 300px;
    }
    (a) text-align (b) font-size (c) background-color (d) 20px
  27. 27.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 22px;
      }
    }
    (a) No (b) Yes
  28. 28.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 10px;
      }
    }
  29. 29.🌈 In #rrggbb, which colour do the last two digits give? (a) red (b) green (c) blue (d) white
  30. 30.📱 max-width: 600px applies when the screen is ___. (a) turned off (b) 600px or narrower (c) 600px or wider (d) exactly 1000px
  31. 31.Which of these does JavaScript do? (a) makes a form box (b) rounds box corners (c) changes the page live (d) adds space around boxes
  32. 32.✍️ What is the selector in this CSS rule?
    h2 {
      font-style: italic;
      font-size: 20px;
      margin: 10px;
    }
    (a) h1 (b) font-style (c) 20px (d) h2
  33. 33.🧩 Which language changes the page live? (a) CSS (b) HTML (c) JavaScript
  34. 34.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 6 (b) 3 (c) 2 (d) 4
  35. 35.🧩 Which language changes the text size? (a) CSS (b) HTML (c) JavaScript
  36. 36.⚖️ What colour is the text of this element?
    <p class="note" id="hero">Hi</p>
    CSS:
    #hero { color: black; }
    p { color: yellow; }
    (a) purple (b) yellow (c) blue (d) black
  37. 37.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 140px;
      padding: 25px;
      border: 1px solid black;
      margin: 20px;
    }
  38. 38.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      text-align: center;
      background-color: yellow;
      border: 2px solid;
    }
  39. 39.💪 Which flexbox property lines boxes up across? (a) display: flex (b) justify-content (c) gap (d) align-items
  40. 40.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 180px;
      padding: 25px;
      border: 5px solid black;
      margin: 0px;
    }

Answer key

  1. { }
  2. puts a picture on a page
  3. flex-end
  4. blue
  5. <h2 id="logo">
  6. the gap round content
  7. 1
  8. 193
  9. 40
  10. 80
  11. white
  12. changes the page live
  13. red
  14. #logo
  15. 106
  16. 8
  17. 120
  18. <p id="end">
  19. color
  20. an id selector
  21. Yes
  22. flex-start
  23. shows a pop-up message
  24. blue
  25. <link>
  26. font-size
  27. Yes
  28. 10
  29. blue
  30. 600px or narrower
  31. changes the page live
  32. h2
  33. JavaScript
  34. 3
  35. CSS
  36. black
  37. 232
  38. 3
  39. align-items
  40. 240

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