← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 214 · 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 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
  2. 2.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 240px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  3. 3.✍️ How many declarations (property: value pairs) are in this rule?
    body {
      border: 2px solid;
    }
  4. 4.💪 Which justify-content value packs boxes at the start? (a) flex-start (b) space-between (c) flex-end (d) center
  5. 5.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      margin: 10px;
    }
  6. 6.📱 The screen is 820px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 26px;
      }
    }
    (a) No (b) Yes
  7. 7.True or false: the content is space inside the border. (a) False (b) True
  8. 8.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 50px;
      padding: 5px;
      border: 4px solid black;
      margin: 5px;
    }
  9. 9.✍️ In color: blue; which part is the value? (a) : (b) blue (c) color (d) ;
  10. 10.🎯 Which CSS selector matches this element?
    <h2 class="menu" id="hero">Hello</h2>
    (a) #menu (b) #top (c) h2 (d) .note
  11. 11.⚖️ What colour is the text of this element?
    <h1 class="menu" id="intro">Hi</h1>
    CSS:
    .menu { color: yellow; }
    h1 { color: red; }
    (a) black (b) yellow (c) red (d) blue
  12. 12.🖌️ What colour are the letters?
    h1 {
      font-size: 28px;
      background-color: black;
      text-align: right;
      color: purple;
    }
    (a) purple (b) green (c) black
  13. 13.🎯 How many elements on a page should have the same id? (a) any number (b) 2 (c) 1 (d) 5
  14. 14.✍️ Which sign ends each CSS declaration? (a) ; (b) , (c) . (d) :
  15. 15.⚖️ What colour is the text of this element?
    <p class="big" id="intro">Hi</p>
    CSS:
    .big { color: orange; }
    .big { color: blue; }
    (a) red (b) yellow (c) orange (d) blue
  16. 16.🌈 In #ba0000 the red part is the hex number ba. What is it as a normal number?
  17. 17.Which of these is margin? (a) the gap to other boxes (b) the gap round content (c) a solid or dotted edge (d) space inside the border
  18. 18.🎨 Which attribute adds CSS inside one tag? (a) style (b) alt (c) src (d) href
  19. 19.📦 In the box model, which part is the gap round content? (a) content (b) border (c) padding (d) margin
  20. 20.⚖️ Which selector is the strongest? (a) an element selector (b) a class selector (c) an id selector
  21. 21.⚖️ What colour is the text of this element?
    <h1 class="menu" id="hero">Hi</h1>
    CSS:
    #hero { color: black; }
    #hero { color: purple; }
    (a) green (b) purple (c) black (d) orange
  22. 22.⚖️ What colour is the text of this element?
    <h2 class="red" id="hero">Hi</h2>
    CSS:
    #hero { color: blue; }
    #hero { color: red; }
    (a) red (b) white (c) blue (d) green
  23. 23.🖌️ What colour is behind the letters?
    li {
      font-size: 24px;
      background-color: white;
      color: yellow;
      text-align: left;
    }
    (a) blue (b) yellow (c) white
  24. 24.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      background-color: yellow;
      width: 300px;
      padding: 8px;
    }
  25. 25.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 120px;
      padding: 5px;
      border: 3px solid black;
      margin: 0px;
    }
  26. 26.🧩 Which language rounds box corners? (a) CSS (b) JavaScript (c) HTML
  27. 27.⚖️ What colour is the text of this element?
    <h2 class="box" id="top">Hi</h2>
    CSS:
    #top { color: orange; }
    .box { color: white; }
    (a) orange (b) green (c) purple (d) white
  28. 28.✍️ In color: blue; which part is the property? (a) : (b) blue (c) ; (d) color
  29. 29.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 26px;
      }
    }
    (a) No (b) Yes
  30. 30.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 60px;
      padding: 25px;
      border: 4px solid black;
      margin: 5px;
    }
  31. 31.🌈 In #040000 the red part is the hex number 04. What is it as a normal number?
  32. 32.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 14px;
      }
    }
  33. 33.🌈 Which colour is #ff0000? (a) blue (b) black (c) red (d) bright green
  34. 34.✍️ CSS declarations go inside which brackets? (a) < > (b) ( ) (c) [ ] (d) { }
  35. 35.🌈 Which hex code is bright green? (a) #ff0000 (b) #0000ff (c) #00ff00 (d) #ffff00
  36. 36.⚖️ What colour is the text of this element?
    <h1 class="big" id="hero">Hi</h1>
    CSS:
    #hero { color: black; }
    h1 { color: yellow; }
    (a) orange (b) yellow (c) black (d) white
  37. 37.📱 min-width: 800px applies when the screen is ___. (a) exactly 100px (b) 800px or wider (c) turned off (d) 800px or narrower
  38. 38.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 110px;
      padding: 5px;
      border: 4px solid black;
      margin: 0px;
    }
  39. 39.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 280px;
      justify-content: center;
    }
    Inside are 3 boxes, each 40px wide (no margins).
  40. 40.True or false: .star is a class selector. (a) True (b) False

Answer key

  1. the viewport meta tag
  2. 80
  3. 1
  4. flex-start
  5. 1
  6. No
  7. False
  8. 68
  9. blue
  10. h2
  11. yellow
  12. purple
  13. 1
  14. ;
  15. blue
  16. 186
  17. the gap to other boxes
  18. style
  19. padding
  20. an id selector
  21. purple
  22. red
  23. white
  24. 3
  25. 136
  26. CSS
  27. orange
  28. color
  29. Yes
  30. 128
  31. 4
  32. 12
  33. red
  34. { }
  35. #00ff00
  36. black
  37. 800px or wider
  38. 128
  39. 80
  40. True

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