← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 462 · 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.🌈 In #dc0000 the red part is the hex number dc. What is it as a normal number?
  2. 2.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 10px;
      }
    }
  3. 3.📱 Responsive design means a page ___. (a) is only for laptops (b) never changes (c) fits every screen (d) has no pictures
  4. 4.✍️ How many declarations (property: value pairs) are in this rule?
    #top {
      border: 2px solid;
    }
  5. 5.✍️ Which property is set to 20px in this rule?
    p {
      text-align: center;
      background-color: yellow;
      font-size: 20px;
      color: red;
    }
    (a) 20px (b) text-align (c) background-color (d) font-size
  6. 6.What does font-weight do? (a) centres a heading (b) makes the text bold (c) picks the font style (d) makes letters bigger
  7. 7.📱 What does a media query check? (a) the page title (b) the time of day (c) the screen width (d) the battery level
  8. 8.🎯 Which element does the selector .box style? (a) <span id="box"> (b) <p class="menu"> (c) <span class="box"> (d) <span class="star">
  9. 9.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 20px;
      }
    }
  10. 10.True or false: margin is space inside the border. (a) False (b) True
  11. 11.🖌️ What colour are the letters?
    h1 {
      font-size: 28px;
      text-align: left;
      color: green;
      background-color: white;
    }
    (a) white (b) orange (c) green
  12. 12.Which of these is margin? (a) space inside the border (b) the line round the box (c) a solid or dotted edge (d) the gap to other boxes
  13. 13.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 240px;
      justify-content: center;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  14. 14.✍️ Which sign ends each CSS declaration? (a) ; (b) : (c) . (d) ,
  15. 15.🌈 Which colour is #ff0000? (a) bright green (b) white (c) red (d) magenta
  16. 16.✍️ What is the selector in this CSS rule?
    body {
      font-style: italic;
      text-align: center;
      color: red;
      border: 2px solid;
    }
    (a) center (b) font-style (c) .box (d) body
  17. 17.📦 In the box model, which part is the text or picture? (a) padding (b) border (c) content (d) margin
  18. 18.💪 Which justify-content value puts boxes in the middle? (a) flex-start (b) center (c) space-between (d) flex-end
  19. 19.🎯 What kind of selector is li? (a) an element selector (b) a class selector (c) an id selector
  20. 20.📦 In the box model, which part is space inside the border? (a) border (b) padding (c) content (d) margin
  21. 21.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 100px;
      padding: 15px;
      border: 1px solid black;
      margin: 0px;
    }
  22. 22.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the first one (b) neither (c) the shorter one (d) the later one
  23. 23.🖌️ Where does the text sit on its line?
    li {
      color: black;
      text-align: left;
      background-color: blue;
      font-size: 12px;
    }
    (a) on the left (b) in the middle (c) on the right
  24. 24.🌈 Which colour is #ffff00? (a) red (b) magenta (c) blue (d) yellow
  25. 25.🎯 Which CSS selector matches this element?
    <li class="big" id="main">Hello</li>
    (a) .red (b) #big (c) .main (d) #main
  26. 26.🖌️ Which CSS property sets the letter colour? (a) font-weight (b) text-align (c) color (d) font-family
  27. 27.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      font-size: 20px;
      font-style: italic;
      text-align: center;
      color: red;
    }
  28. 28.Which of these does HTML do? (a) shows a pop-up message (b) reacts to a button click (c) changes the text size (d) puts a picture on a page
  29. 29.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 20px;
      }
    }
    (a) Yes (b) No
  30. 30.True or false: CSS gives the page structure. (a) False (b) True
  31. 31.🎯 Which CSS selector matches this element?
    <div class="note" id="top">Hello</div>
    (a) #note (b) span (c) .top (d) div
  32. 32.🌈 Which colour is #0000ff? (a) cyan (b) blue (c) magenta (d) black
  33. 33.✍️ What value is given to padding in this rule?
    body {
      font-style: italic;
      color: red;
      padding: 8px;
      font-weight: bold;
    }
    (a) 8px (b) padding (c) 2px solid (d) bold
  34. 34.Which of these does CSS do? (a) lays out the page (b) changes the page live (c) checks a quiz answer (d) gives the page structure
  35. 35.🎨 What does CSS stand for? (a) Computer Style Sheets (b) Creative Sheet System (c) Colourful Site Styles (d) Cascading Style Sheets
  36. 36.🎯 Which element does the selector #end style? (a) <li id="end"> (b) <li id="hero"> (c) <div class="red"> (d) <li class="end">
  37. 37.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 280px;
      justify-content: space-between;
    }
    Inside are 3 boxes, each 40px wide (no margins).
  38. 38.🔍 Which is the odd one out? (a) gives the page structure (b) adds space around boxes (c) puts a picture on a page (d) makes a link
  39. 39.📱 Which tag helps phones show a page at the right size? (a) the br tag (b) the viewport meta tag (c) the hr tag (d) the title tag
  40. 40.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 24px;
      }
    }
    (a) No (b) Yes

Answer key

  1. 220
  2. 10
  3. fits every screen
  4. 1
  5. font-size
  6. makes the text bold
  7. the screen width
  8. <span class="box">
  9. 12
  10. False
  11. green
  12. the gap to other boxes
  13. 80
  14. ;
  15. red
  16. body
  17. content
  18. center
  19. an element selector
  20. padding
  21. 132
  22. the later one
  23. on the left
  24. yellow
  25. #main
  26. color
  27. 4
  28. puts a picture on a page
  29. No
  30. False
  31. div
  32. blue
  33. 8px
  34. lays out the page
  35. Cascading Style Sheets
  36. <li id="end">
  37. 80
  38. adds space around boxes
  39. the viewport meta tag
  40. No

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