← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 834 · 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.🖌️ What colour are the letters?
    p {
      color: white;
      text-align: right;
      font-size: 32px;
      background-color: black;
    }
    (a) white (b) orange (c) black
  2. 2.⚖️ What colour is the text of this element?
    <h1 class="note" id="top">Hi</h1>
    CSS:
    h1 { color: green; }
    .note { color: black; }
    (a) purple (b) green (c) red (d) black
  3. 3.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 26px;
      }
    }
    (a) No (b) Yes
  4. 4.🌈 In #0000b9 the blue part is the hex number b9. What is it as a normal number?
  5. 5.🎯 Which CSS selector matches this element?
    <span class="star" id="main">Hello</span>
    (a) .main (b) span (c) p (d) .menu
  6. 6.⚖️ What colour is the text of this element?
    <h2 class="red" id="end">Hi</h2>
    CSS:
    .red { color: red; }
    #end { color: white; }
    h2 { color: purple; }
    (a) blue (b) red (c) purple (d) white
  7. 7.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 210px;
      padding: 30px;
      border: 3px solid black;
      margin: 0px;
    }
  8. 8.🎯 Which element does the selector h2 style? (a) <h2 class="big"> (b) <span id="top"> (c) <li> (d) <div class="big">
  9. 9.📱 Responsive design means a page ___. (a) has no pictures (b) fits every screen (c) is only for laptops (d) never changes
  10. 10.⚖️ What colour is the text of this element?
    <h1 class="red" id="hero">Hi</h1>
    CSS:
    .red { color: blue; }
    h1 { color: red; }
    #hero { color: yellow; }
    (a) yellow (b) orange (c) blue (d) red
  11. 11.🎯 Which CSS selector matches this element?
    <p class="star" id="hero">Hello</p>
    (a) .hero (b) .star (c) .menu (d) h1
  12. 12.🖌️ What colour are the letters?
    p {
      font-size: 12px;
      background-color: yellow;
      color: blue;
      text-align: right;
    }
    (a) blue (b) yellow (c) purple
  13. 13.Which of these is the border? (a) a solid or dotted edge (b) space inside the border (c) space outside the border (d) the gap round content
  14. 14.True or false: the border is a solid or dotted edge. (a) True (b) False
  15. 15.🌈 Which hex code is white? (a) #000000 (b) #ffff00 (c) #ffffff (d) #ff0000
  16. 16.✍️ Which sign ends each CSS declaration? (a) . (b) , (c) ; (d) :
  17. 17.🖌️ How big is the text, in px?
    li {
      color: orange;
      font-size: 16px;
      background-color: blue;
      text-align: center;
    }
  18. 18.🌈 Which hex code is yellow? (a) #ffff00 (b) #ff0000 (c) #00ff00 (d) #0000ff
  19. 19.True or false: .big is a class selector. (a) False (b) True
  20. 20.⚖️ Which selector is the strongest? (a) a class selector (b) an id selector (c) an element selector
  21. 21.🎯 Which element does the selector span style? (a) <h1 class="note"> (b) <span class="note"> (c) <p> (d) <h2 id="intro">
  22. 22.True or false: the border is space inside the border. (a) False (b) True
  23. 23.🎨 A CSS file usually ends with which extension? (a) .js (b) .html (c) .png (d) .css
  24. 24.💪 Which flexbox property spaces boxes along a row? (a) gap (b) justify-content (c) display: flex (d) flex-direction
  25. 25.⚖️ What colour is the text of this element?
    <h2 class="menu" id="top">Hi</h2>
    CSS:
    #top { color: orange; }
    .menu { color: yellow; }
    (a) green (b) orange (c) yellow (d) white
  26. 26.Which of these does JavaScript do? (a) gives the page structure (b) puts a picture on a page (c) lays out the page (d) changes the page live
  27. 27.✍️ How does a CSS comment start? (a) <!-- (b) // (c) /* (d) #
  28. 28.What does font-family do? (a) makes letters bigger (b) sets the letter colour (c) centres a heading (d) picks the font style
  29. 29.⚖️ What colour is the text of this element?
    <h1 class="note" id="logo">Hi</h1>
    CSS:
    .note { color: red; }
    h1 { color: purple; }
    (a) red (b) white (c) purple (d) orange
  30. 30.🎯 Which element does the selector p style? (a) <p class="box"> (b) <li id="logo"> (c) <h2 class="box"> (d) <h1>
  31. 31.📱 max-width: 600px applies when the screen is ___. (a) exactly 1000px (b) 600px or wider (c) turned off (d) 600px or narrower
  32. 32.🧩 Which language lays out the page? (a) CSS (b) JavaScript (c) HTML
  33. 33.⚖️ Which selector is the weakest? (a) a class selector (b) an element selector (c) an id selector
  34. 34.True or false: JavaScript checks a quiz answer. (a) False (b) True
  35. 35.✍️ What value is given to background-color in this rule?
    body {
      background-color: yellow;
      padding: 8px;
      margin: 10px;
    }
    (a) background-color (b) yellow (c) 10px (d) 8px
  36. 36.🌈 In #rrggbb, which colour do the first two digits give? (a) green (b) blue (c) black (d) red
  37. 37.💪 Which flexbox property sets space between boxes? (a) gap (b) justify-content (c) align-items (d) flex-direction
  38. 38.✍️ What is the selector in this CSS rule?
    #top {
      color: red;
      width: 300px;
      text-align: center;
    }
    (a) li (b) color (c) #top (d) 300px
  39. 39.⚖️ What colour is the text of this element?
    <h2 class="red" id="hero">Hi</h2>
    CSS:
    h2 { color: yellow; }
    #hero { color: red; }
    (a) blue (b) yellow (c) red (d) white
  40. 40.🎯 Which CSS selector matches this element?
    <div class="box" id="intro">Hello</div>
    (a) .star (b) #box (c) #main (d) div

Answer key

  1. white
  2. black
  3. No
  4. 185
  5. span
  6. white
  7. 276
  8. <h2 class="big">
  9. fits every screen
  10. yellow
  11. .star
  12. blue
  13. a solid or dotted edge
  14. True
  15. #ffffff
  16. ;
  17. 16
  18. #ffff00
  19. True
  20. an id selector
  21. <span class="note">
  22. False
  23. .css
  24. justify-content
  25. orange
  26. changes the page live
  27. /*
  28. picks the font style
  29. red
  30. <p class="box">
  31. 600px or narrower
  32. CSS
  33. an element selector
  34. True
  35. yellow
  36. red
  37. gap
  38. #top
  39. red
  40. div

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