← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 828 · 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 element does the selector .big style? (a) <h2 class="box"> (b) <h1 class="red"> (c) <h1 id="big"> (d) <h1 class="big">
  2. 2.🖌️ Which CSS property colours behind the text? (a) color (b) background-color (c) font-size (d) text-align
  3. 3.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 300px;
      justify-content: center;
    }
    Inside are 3 boxes, each 60px wide (no margins).
  4. 4.🌈 Hex digits go 0 to 9, then A to which letter? (a) J (b) F (c) Z (d) G
  5. 5.🌈 Which colour is rgb(255, 0, 255)? (a) red (b) cyan (c) magenta (d) black
  6. 6.✍️ Which sign ends each CSS declaration? (a) . (b) ; (c) : (d) ,
  7. 7.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 210px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  8. 8.🎯 Which element does the selector #main style? (a) <h1 id="main"> (b) <h2 class="red"> (c) <h1 id="logo"> (d) <h1 class="main">
  9. 9.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 16px;
      }
    }
  10. 10.True or false: the border is a solid or dotted edge. (a) True (b) False
  11. 11.True or false: JavaScript adds space around boxes. (a) True (b) False
  12. 12.✍️ What value is given to font-size in this rule?
    .box {
      font-size: 20px;
      background-color: yellow;
      text-align: center;
      font-weight: bold;
    }
    (a) font-size (b) yellow (c) 20px (d) center
  13. 13.⚖️ What colour is the text of this element?
    <h2 class="big" id="hero">Hi</h2>
    CSS:
    h2 { color: orange; }
    h2 { color: green; }
    (a) black (b) green (c) orange (d) yellow
  14. 14.Which of these is margin? (a) the line round the box (b) the text or picture (c) space outside the border (d) a solid or dotted edge
  15. 15.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 22px;
      }
    }
  16. 16.⚖️ Which selector is the strongest? (a) a class selector (b) an id selector (c) an element selector
  17. 17.⚖️ What colour is the text of this element?
    <h2 class="star" id="end">Hi</h2>
    CSS:
    #end { color: white; }
    h2 { color: purple; }
    .star { color: blue; }
    (a) purple (b) blue (c) red (d) white
  18. 18.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) exactly 100px (c) 800px or wider (d) turned off
  19. 19.🌈 Which colour is rgb(255, 0, 0)? (a) magenta (b) red (c) bright green (d) white
  20. 20.💪 Which justify-content value packs boxes at the start? (a) center (b) flex-end (c) flex-start (d) space-between
  21. 21.✍️ In color: blue; which part is the property? (a) color (b) blue (c) : (d) ;
  22. 22.✍️ What is the selector in this CSS rule?
    li {
      text-align: center;
      border: 2px solid;
    }
    (a) li (b) 2px solid (c) body (d) text-align
  23. 23.True or false: CSS makes a form box. (a) False (b) True
  24. 24.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      font-size: 20px;
      margin: 10px;
      color: red;
    }
  25. 25.⚖️ What colour is the text of this element?
    <h2 class="big" id="logo">Hi</h2>
    CSS:
    h2 { color: white; }
    #logo { color: purple; }
    (a) black (b) white (c) purple (d) orange
  26. 26.⚖️ What colour is the text of this element?
    <h1 class="red" id="logo">Hi</h1>
    CSS:
    #logo { color: purple; }
    .red { color: orange; }
    (a) green (b) blue (c) purple (d) orange
  27. 27.⚖️ Which selector is the weakest? (a) a class selector (b) an id selector (c) an element selector
  28. 28.✍️ What is the selector in this CSS rule?
    h2 {
      font-style: italic;
      color: red;
    }
    (a) h1 (b) font-style (c) h2 (d) red
  29. 29.🌈 Which hex code is black? (a) #0000ff (b) #00ff00 (c) #000000 (d) #ffffff
  30. 30.⚖️ What colour is the text of this element?
    <h1 class="red" id="logo">Hi</h1>
    CSS:
    .red { color: black; }
    #logo { color: red; }
    (a) blue (b) black (c) green (d) red
  31. 31.✍️ What value is given to font-size in this rule?
    p {
      padding: 8px;
      border: 2px solid;
      font-size: 20px;
    }
    (a) 20px (b) yellow (c) font-size (d) center
  32. 32.🎯 Which sign starts an id selector? (a) # (b) @ (c) & (d) .
  33. 33.🌈 Which hex code is white? (a) #00ff00 (b) #ffffff (c) #ffff00 (d) #000000
  34. 34.🖌️ Which CSS property picks the font style? (a) color (b) font-family (c) text-align (d) background-color
  35. 35.✍️ Which sign goes between a property and its value? (a) - (b) ; (c) : (d) =
  36. 36.📱 The screen is 1366px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 18px;
      }
    }
    (a) No (b) Yes
  37. 37.🌈 In #620000 the red part is the hex number 62. What is it as a normal number?
  38. 38.🎨 Which attribute adds CSS inside one tag? (a) href (b) alt (c) style (d) src
  39. 39.🎯 How many elements on a page should have the same id? (a) any number (b) 1 (c) 2 (d) 5
  40. 40.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 200px;
      padding: 10px;
      border: 3px solid black;
      margin: 0px;
    }

Answer key

  1. <h1 class="big">
  2. background-color
  3. 60
  4. F
  5. magenta
  6. ;
  7. 50
  8. <h1 id="main">
  9. 16
  10. True
  11. False
  12. 20px
  13. green
  14. space outside the border
  15. 22
  16. an id selector
  17. white
  18. 800px or wider
  19. red
  20. flex-start
  21. color
  22. li
  23. False
  24. 3
  25. purple
  26. purple
  27. an element selector
  28. h2
  29. #000000
  30. red
  31. 20px
  32. #
  33. #ffffff
  34. font-family
  35. :
  36. Yes
  37. 98
  38. style
  39. 1
  40. 226

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