← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 262 · 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.🌈 Which colour of light is strongest in rgb(124, 26, 156)? (a) green (b) red (c) blue
  2. 2.💪 Which flexbox property picks row or column? (a) flex-direction (b) display: flex (c) align-items (d) gap
  3. 3.🌈 Which colour is rgb(255, 255, 0)? (a) cyan (b) yellow (c) black (d) blue
  4. 4.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      margin: 10px;
      font-size: 20px;
      background-color: yellow;
    }
  5. 5.✍️ Which sign ends each CSS declaration? (a) . (b) : (c) , (d) ;
  6. 6.💪 Which flexbox property lines boxes up across? (a) align-items (b) display: flex (c) gap (d) justify-content
  7. 7.Which of these does CSS do? (a) counts down a timer (b) reacts to a button click (c) gives the page structure (d) changes the text size
  8. 8.What does font-size do? (a) makes letters bigger (b) colours behind the text (c) makes the text bold (d) picks the font style
  9. 9.🧩 Which language adds space around boxes? (a) CSS (b) JavaScript (c) HTML
  10. 10.🌈 In #00000a the blue part is the hex number 0a. What is it as a normal number?
  11. 11.True or false: the content is a solid or dotted edge. (a) True (b) False
  12. 12.🎯 Which element does the selector h2 style? (a) <span id="logo"> (b) <li> (c) <h2 class="big"> (d) <div class="big">
  13. 13.📱 Which tag helps phones show a page at the right size? (a) the br tag (b) the title tag (c) the viewport meta tag (d) the hr tag
  14. 14.⚖️ What colour is the text of this element?
    <p class="star" id="logo">Hi</p>
    CSS:
    #logo { color: blue; }
    #logo { color: black; }
    (a) black (b) red (c) green (d) blue
  15. 15.⚖️ What colour is the text of this element?
    <h1 class="red" id="logo">Hi</h1>
    CSS:
    .red { color: yellow; }
    .red { color: red; }
    (a) black (b) yellow (c) purple (d) red
  16. 16.📱 What does a media query check? (a) the page title (b) the screen width (c) the battery level (d) the time of day
  17. 17.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 3 (b) 4 (c) 2 (d) 6
  18. 18.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 18px;
      }
    }
    (a) No (b) Yes
  19. 19.⚖️ What colour is the text of this element?
    <p class="big" id="main">Hi</p>
    CSS:
    .big { color: yellow; }
    #main { color: purple; }
    (a) yellow (b) black (c) blue (d) purple
  20. 20.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 340px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 100px wide (no margins).
  21. 21.🧩 Which language puts a picture on a page? (a) CSS (b) JavaScript (c) HTML
  22. 22.✍️ Which sign goes between a property and its value? (a) ; (b) : (c) = (d) -
  23. 23.Which of these does CSS do? (a) changes the page live (b) counts down a timer (c) makes a link (d) lays out the page
  24. 24.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 14px;
      }
    }
    (a) Yes (b) No
  25. 25.Which of these is the border? (a) the text or picture (b) space inside the border (c) space outside the border (d) a solid or dotted edge
  26. 26.🌈 What is the biggest number one colour can have in rgb()? (a) 100 (b) 1000 (c) 99 (d) 255
  27. 27.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 230px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 80px wide (no margins).
  28. 28.🎯 Which CSS selector matches this element?
    <li class="box" id="hero">Hello</li>
    (a) #box (b) .hero (c) .star (d) li
  29. 29.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 60px;
      padding: 10px;
      border: 3px solid black;
      margin: 15px;
    }
  30. 30.🌈 In #630000 the red part is the hex number 63. What is it as a normal number?
  31. 31.True or false: HTML changes the text size. (a) False (b) True
  32. 32.🖌️ What colour are the letters?
    li {
      background-color: yellow;
      color: red;
      text-align: right;
      font-size: 16px;
    }
    (a) yellow (b) red (c) orange
  33. 33.🌈 Which colour is #00ffff? (a) bright green (b) red (c) blue (d) cyan
  34. 34.🌈 In #890000 the red part is the hex number 89. What is it as a normal number?
  35. 35.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 90px;
      padding: 5px;
      border: 4px solid black;
      margin: 0px;
    }
  36. 36.📱 The screen is 820px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 8px;
      }
    }
    (a) Yes (b) No
  37. 37.⚖️ What colour is the text of this element?
    <p class="menu" id="end">Hi</p>
    CSS:
    p { color: yellow; }
    #end { color: red; }
    (a) white (b) purple (c) red (d) yellow
  38. 38.Which of these does CSS do? (a) sets colours and fonts (b) makes a link (c) changes the page live (d) gives the page structure
  39. 39.🔍 Which is the odd one out? (a) sets colours and fonts (b) changes the text size (c) rounds box corners (d) makes a link
  40. 40.Which of these does HTML do? (a) makes a form box (b) sets colours and fonts (c) adds space around boxes (d) checks a quiz answer

Answer key

  1. blue
  2. flex-direction
  3. yellow
  4. 3
  5. ;
  6. align-items
  7. changes the text size
  8. makes letters bigger
  9. CSS
  10. 10
  11. False
  12. <h2 class="big">
  13. the viewport meta tag
  14. black
  15. red
  16. the screen width
  17. 3
  18. Yes
  19. purple
  20. 40
  21. HTML
  22. :
  23. lays out the page
  24. No
  25. a solid or dotted edge
  26. 255
  27. 70
  28. li
  29. 116
  30. 99
  31. False
  32. red
  33. cyan
  34. 137
  35. 108
  36. No
  37. red
  38. sets colours and fonts
  39. makes a link
  40. makes a form box

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