← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 724 · 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 CSS selector matches this element?
    <span class="big" id="top">Hello</span>
    (a) #big (b) .big (c) .top (d) .red
  2. 2.✍️ In color: blue; which part is the property? (a) : (b) color (c) blue (d) ;
  3. 3.🌈 Which colour of light is strongest in rgb(57, 25, 244)? (a) green (b) blue (c) red
  4. 4.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 22px;
      }
    }
    (a) Yes (b) No
  5. 5.🖌️ What colour are the letters?
    li {
      background-color: yellow;
      color: orange;
      font-size: 16px;
      text-align: center;
    }
    (a) yellow (b) black (c) orange
  6. 6.🎯 Which element does the selector .note style? (a) <h2 id="note"> (b) <h2 class="note"> (c) <h2 class="big"> (d) <li class="red">
  7. 7.✍️ Which sign ends each CSS declaration? (a) . (b) : (c) ; (d) ,
  8. 8.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 180px;
      justify-content: space-between;
    }
    Inside are 3 boxes, each 40px wide (no margins).
  9. 9.💪 Which flexbox property lines boxes up across? (a) gap (b) align-items (c) flex-direction (d) display: flex
  10. 10.True or false: CSS sets colours and fonts. (a) False (b) True
  11. 11.🖌️ Which CSS property colours behind the text? (a) font-weight (b) font-size (c) background-color (d) font-family
  12. 12.🧩 Which language sets colours and fonts? (a) HTML (b) JavaScript (c) CSS
  13. 13.🌈 Which hex code is black? (a) #00ffff (b) #000000 (c) #ff00ff (d) #00ff00
  14. 14.Which of these does JavaScript do? (a) adds space around boxes (b) sets colours and fonts (c) changes the text size (d) counts down a timer
  15. 15.⚖️ Which selector is the strongest? (a) an id selector (b) an element selector (c) a class selector
  16. 16.✍️ What is the selector in this CSS rule?
    h1 {
      background-color: yellow;
      color: red;
      margin: 10px;
    }
    (a) p (b) background-color (c) h1 (d) red
  17. 17.🌈 In #890000 the red part is the hex number 89. What is it as a normal number?
  18. 18.🖌️ What colour is behind the letters?
    h1 {
      background-color: blue;
      color: red;
      font-size: 28px;
      text-align: right;
    }
    (a) red (b) black (c) blue
  19. 19.🎨 Which attribute adds CSS inside one tag? (a) alt (b) href (c) src (d) style
  20. 20.⚖️ What colour is the text of this element?
    <p class="note" id="end">Hi</p>
    CSS:
    #end { color: orange; }
    #end { color: yellow; }
    (a) red (b) blue (c) orange (d) yellow
  21. 21.✍️ What value is given to text-align in this rule?
    .box {
      font-weight: bold;
      text-align: center;
    }
    (a) 10px (b) center (c) text-align (d) yellow
  22. 22.⚖️ Which selector is the weakest? (a) a class selector (b) an id selector (c) an element selector
  23. 23.📱 Which tag helps phones show a page at the right size? (a) the viewport meta tag (b) the hr tag (c) the br tag (d) the title tag
  24. 24.🌈 In #c10000 the red part is the hex number c1. What is it as a normal number?
  25. 25.✍️ Which property is set to italic in this rule?
    #top {
      color: red;
      font-style: italic;
    }
    (a) italic (b) font-style (c) color (d) font-size
  26. 26.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 220px;
      justify-content: center;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  27. 27.🌈 What is the biggest number one colour can have in rgb()? (a) 100 (b) 1000 (c) 255 (d) 99
  28. 28.📱 max-width: 600px applies when the screen is ___. (a) exactly 1000px (b) turned off (c) 600px or narrower (d) 600px or wider
  29. 29.🔍 Which is the odd one out? (a) makes headings and lists (b) shows a pop-up message (c) checks a quiz answer (d) counts down a timer
  30. 30.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 190px;
      padding: 20px;
      border: 4px solid black;
      margin: 10px;
    }
  31. 31.⚖️ What colour is the text of this element?
    <h1 class="red" id="main">Hi</h1>
    CSS:
    #main { color: white; }
    h1 { color: yellow; }
    .red { color: orange; }
    (a) orange (b) purple (c) white (d) yellow
  32. 32.✍️ In color: blue; which part is the value? (a) : (b) ; (c) blue (d) color
  33. 33.🌈 In #0000d1 the blue part is the hex number d1. What is it as a normal number?
  34. 34.✍️ Which property is set to red in this rule?
    h2 {
      font-size: 20px;
      color: red;
      border: 2px solid;
    }
    (a) red (b) text-align (c) font-size (d) color
  35. 35.🌈 Which colour is rgb(0, 255, 0)? (a) cyan (b) bright green (c) red (d) blue
  36. 36.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 230px;
      padding: 15px;
      border: 1px solid black;
      margin: 10px;
    }
  37. 37.⚖️ What colour is the text of this element?
    <h2 class="note" id="top">Hi</h2>
    CSS:
    .note { color: yellow; }
    h2 { color: orange; }
    #top { color: black; }
    (a) purple (b) black (c) yellow (d) orange
  38. 38.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 32px;
      }
    }
  39. 39.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 4 (b) 2 (c) 6 (d) 3
  40. 40.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 12px;
      }
    }
    (a) Yes (b) No

Answer key

  1. .big
  2. color
  3. blue
  4. No
  5. orange
  6. <h2 class="note">
  7. ;
  8. 30
  9. align-items
  10. True
  11. background-color
  12. CSS
  13. #000000
  14. counts down a timer
  15. an id selector
  16. h1
  17. 137
  18. blue
  19. style
  20. yellow
  21. center
  22. an element selector
  23. the viewport meta tag
  24. 193
  25. font-style
  26. 10
  27. 255
  28. 600px or narrower
  29. makes headings and lists
  30. 258
  31. white
  32. blue
  33. 209
  34. color
  35. bright green
  36. 262
  37. black
  38. 32
  39. 3
  40. Yes

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