← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 114 · 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 much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 180px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 80px wide (no margins).
  2. 2.🖌️ Which CSS property makes letters bigger? (a) background-color (b) color (c) font-weight (d) font-size
  3. 3.✍️ In color: blue; which part is the property? (a) blue (b) : (c) color (d) ;
  4. 4.💪 Which justify-content value packs boxes at the end? (a) flex-end (b) center (c) space-between (d) flex-start
  5. 5.True or false: #end is an id selector. (a) False (b) True
  6. 6.🧩 Which language puts a picture on a page? (a) JavaScript (b) CSS (c) HTML
  7. 7.🎯 How many elements on a page should have the same id? (a) any number (b) 1 (c) 2 (d) 5
  8. 8.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 100px;
      padding: 20px;
      border: 2px solid black;
      margin: 0px;
    }
  9. 9.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 120px;
      padding: 20px;
      border: 3px solid black;
      margin: 0px;
    }
  10. 10.🎯 What kind of selector is .note? (a) an element selector (b) a class selector (c) an id selector
  11. 11.True or false: the content is space outside the border. (a) False (b) True
  12. 12.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 270px;
      padding: 5px;
      border: 5px solid black;
      margin: 0px;
    }
  13. 13.💪 Which flexbox property turns on flexbox? (a) gap (b) display: flex (c) align-items (d) justify-content
  14. 14.🌈 What is the biggest number one colour can have in rgb()? (a) 100 (b) 255 (c) 99 (d) 1000
  15. 15.🌈 In #rrggbb, which colour do the first two digits give? (a) red (b) green (c) black (d) blue
  16. 16.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) the first one (c) neither (d) the later one
  17. 17.⚖️ What colour is the text of this element?
    <p class="red" id="logo">Hi</p>
    CSS:
    p { color: orange; }
    p { color: black; }
    (a) black (b) white (c) blue (d) orange
  18. 18.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      color: red;
      text-align: center;
      margin: 10px;
      font-style: italic;
    }
  19. 19.🎯 Which CSS selector matches this element?
    <p class="box" id="logo">Hello</p>
    (a) .box (b) h1 (c) #end (d) .logo
  20. 20.🎯 Which CSS selector matches this element?
    <p class="menu" id="top">Hello</p>
    (a) h1 (b) .note (c) p (d) .top
  21. 21.✍️ CSS declarations go inside which brackets? (a) { } (b) ( ) (c) < > (d) [ ]
  22. 22.🎯 Which CSS selector matches this element?
    <h2 class="star" id="end">Hello</h2>
    (a) .menu (b) .end (c) h2 (d) #star
  23. 23.🎨 A CSS file usually ends with which extension? (a) .png (b) .js (c) .css (d) .html
  24. 24.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 120px;
      padding: 25px;
      border: 5px solid black;
      margin: 20px;
    }
  25. 25.🌈 Which colour is #ff00ff? (a) cyan (b) blue (c) white (d) magenta
  26. 26.⚖️ Which selector is the weakest? (a) a class selector (b) an element selector (c) an id selector
  27. 27.True or false: JavaScript gives the page structure. (a) True (b) False
  28. 28.🌈 Which colour is rgb(255, 0, 255)? (a) bright green (b) black (c) red (d) magenta
  29. 29.📦 In the box model, which part is the text or picture? (a) margin (b) border (c) padding (d) content
  30. 30.✍️ What value is given to font-size in this rule?
    .note {
      font-size: 20px;
      text-align: center;
      margin: 10px;
    }
    (a) font-size (b) center (c) yellow (d) 20px
  31. 31.🌈 Which colour is rgb(0, 255, 255)? (a) white (b) blue (c) red (d) cyan
  32. 32.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 10px;
      }
    }
  33. 33.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 18px;
      }
    }
    (a) Yes (b) No
  34. 34.🖌️ How big is the text, in px?
    h1 {
      font-size: 16px;
      color: white;
      background-color: green;
      text-align: center;
    }
  35. 35.🌈 Hex digits go 0 to 9, then A to which letter? (a) Z (b) G (c) F (d) J
  36. 36.✍️ What value is given to width in this rule?
    li {
      padding: 8px;
      width: 300px;
      margin: 10px;
    }
    (a) italic (b) 300px (c) red (d) width
  37. 37.✍️ What value is given to background-color in this rule?
    .note {
      background-color: yellow;
      margin: 10px;
      text-align: center;
    }
    (a) yellow (b) 8px (c) background-color (d) 10px
  38. 38.Which of these is the content? (a) the text or picture (b) a solid or dotted edge (c) space inside the border (d) space outside the border
  39. 39.Which of these does CSS do? (a) gives the page structure (b) makes a form box (c) checks a quiz answer (d) sets colours and fonts
  40. 40.📱 What does a media query check? (a) the time of day (b) the battery level (c) the screen width (d) the page title

Answer key

  1. 20
  2. font-size
  3. color
  4. flex-end
  5. True
  6. HTML
  7. 1
  8. 144
  9. 166
  10. a class selector
  11. False
  12. 290
  13. display: flex
  14. 255
  15. red
  16. the later one
  17. black
  18. 4
  19. .box
  20. p
  21. { }
  22. h2
  23. .css
  24. 180
  25. magenta
  26. an element selector
  27. False
  28. magenta
  29. content
  30. 20px
  31. cyan
  32. 10
  33. No
  34. 16
  35. F
  36. 300px
  37. yellow
  38. the text or picture
  39. sets colours and fonts
  40. the screen width

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