← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 686 · 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 is the selector in this CSS rule?
    li {
      padding: 8px;
      text-align: center;
      background-color: yellow;
    }
    (a) body (b) padding (c) li (d) center
  2. 2.🖌️ How big is the text, in px?
    h2 {
      text-align: left;
      color: orange;
      background-color: black;
      font-size: 28px;
    }
  3. 3.True or false: #end is a class selector. (a) False (b) True
  4. 4.📱 min-width: 800px applies when the screen is ___. (a) 800px or wider (b) exactly 100px (c) turned off (d) 800px or narrower
  5. 5.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the later one (b) neither (c) the first one (d) the shorter one
  6. 6.🎯 Which CSS selector matches this element?
    <h2 class="red" id="logo">Hello</h2>
    (a) .box (b) #red (c) .red (d) li
  7. 7.Which of these is the content? (a) the text or picture (b) the gap round content (c) a solid or dotted edge (d) space inside the border
  8. 8.⚖️ What colour is the text of this element?
    <h2 class="note" id="top">Hi</h2>
    CSS:
    #top { color: orange; }
    #top { color: black; }
    (a) red (b) orange (c) black (d) purple
  9. 9.⚖️ What colour is the text of this element?
    <h1 class="note" id="intro">Hi</h1>
    CSS:
    h1 { color: green; }
    h1 { color: orange; }
    (a) red (b) green (c) orange (d) black
  10. 10.🎯 What kind of selector is h1? (a) an id selector (b) a class selector (c) an element selector
  11. 11.Which of these does CSS do? (a) puts a picture on a page (b) changes the page live (c) makes a form box (d) changes the text size
  12. 12.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 18px;
      }
    }
  13. 13.✍️ Which sign goes between a property and its value? (a) - (b) = (c) : (d) ;
  14. 14.🌈 In #290000 the red part is the hex number 29. What is it as a normal number?
  15. 15.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 220px;
      padding: 5px;
      border: 5px solid black;
      margin: 10px;
    }
  16. 16.🎯 Which element does the selector .box style? (a) <span class="star"> (b) <span class="box"> (c) <p class="menu"> (d) <span id="box">
  17. 17.🌈 Which colour is rgb(255, 255, 255)? (a) yellow (b) bright green (c) blue (d) white
  18. 18.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 140px;
      padding: 5px;
      border: 4px solid black;
      margin: 20px;
    }
  19. 19.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 160px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  20. 20.Which of these does HTML do? (a) checks a quiz answer (b) makes a form box (c) lays out the page (d) counts down a timer
  21. 21.True or false: .star is an element selector. (a) True (b) False
  22. 22.⚖️ What colour is the text of this element?
    <p class="note" id="top">Hi</p>
    CSS:
    #top { color: blue; }
    #top { color: purple; }
    (a) black (b) purple (c) blue (d) orange
  23. 23.Which of these does CSS do? (a) counts down a timer (b) gives the page structure (c) lays out the page (d) puts a picture on a page
  24. 24.🎨 What does CSS stand for? (a) Cascading Style Sheets (b) Computer Style Sheets (c) Creative Sheet System (d) Colourful Site Styles
  25. 25.🎯 Which sign starts an id selector? (a) & (b) . (c) @ (d) #
  26. 26.Which of these does CSS do? (a) reacts to a button click (b) gives the page structure (c) adds space around boxes (d) puts a picture on a page
  27. 27.What does color do? (a) centres a heading (b) sets the letter colour (c) colours behind the text (d) makes letters bigger
  28. 28.✍️ CSS declarations go inside which brackets? (a) { } (b) [ ] (c) ( ) (d) < >
  29. 29.📦 In the box model, which part is the gap round content? (a) content (b) padding (c) border (d) margin
  30. 30.🎯 Which CSS selector matches this element?
    <span class="big" id="logo">Hello</span>
    (a) .big (b) #big (c) .logo (d) #end
  31. 31.True or false: JavaScript makes headings and lists. (a) False (b) True
  32. 32.💪 Which justify-content value packs boxes at the end? (a) space-between (b) flex-end (c) center (d) flex-start
  33. 33.🖌️ Where does the text sit on its line?
    li {
      text-align: left;
      font-size: 12px;
      color: blue;
      background-color: orange;
    }
    (a) on the right (b) on the left (c) in the middle
  34. 34.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 400px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 80px wide (no margins).
  35. 35.✍️ Which sign ends each CSS declaration? (a) . (b) , (c) ; (d) :
  36. 36.🎯 How many elements on a page should have the same id? (a) 1 (b) 2 (c) any number (d) 5
  37. 37.📱 The screen is 1366px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 18px;
      }
    }
    (a) No (b) Yes
  38. 38.🎯 What kind of selector is .big? (a) a class selector (b) an id selector (c) an element selector
  39. 39.🎯 Which element does the selector .box style? (a) <h1 class="star"> (b) <h2 class="menu"> (c) <h1 class="box"> (d) <h1 id="box">
  40. 40.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 10px;
      }
    }
    (a) Yes (b) No

Answer key

  1. li
  2. 28
  3. False
  4. 800px or wider
  5. the later one
  6. .red
  7. the text or picture
  8. black
  9. orange
  10. an element selector
  11. changes the text size
  12. 18
  13. :
  14. 41
  15. 260
  16. <span class="box">
  17. white
  18. 158
  19. 40
  20. makes a form box
  21. False
  22. purple
  23. lays out the page
  24. Cascading Style Sheets
  25. #
  26. adds space around boxes
  27. sets the letter colour
  28. { }
  29. padding
  30. .big
  31. False
  32. flex-end
  33. on the left
  34. 80
  35. ;
  36. 1
  37. Yes
  38. a class selector
  39. <h1 class="box">
  40. No

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