← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 353 · 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 language rounds box corners? (a) CSS (b) HTML (c) JavaScript
  2. 2.⚖️ What colour is the text of this element?
    <h1 class="menu" id="end">Hi</h1>
    CSS:
    .menu { color: blue; }
    h1 { color: orange; }
    (a) orange (b) yellow (c) blue (d) black
  3. 3.⚖️ What colour is the text of this element?
    <p class="red" id="intro">Hi</p>
    CSS:
    #intro { color: white; }
    #intro { color: orange; }
    (a) yellow (b) white (c) red (d) orange
  4. 4.What does justify-content: space-between do? (a) puts boxes in the middle (b) packs boxes at the end (c) equal gaps, none at ends (d) packs boxes at the start
  5. 5.True or false: padding is the gap round content. (a) False (b) True
  6. 6.🖌️ How big is the text, in px?
    h2 {
      color: blue;
      font-size: 40px;
      background-color: red;
      text-align: center;
    }
  7. 7.🌈 Which colour is #ff00ff? (a) yellow (b) cyan (c) white (d) magenta
  8. 8.🎯 Which element does the selector .star style? (a) <h1 class="star"> (b) <h1 id="star"> (c) <h1 class="menu"> (d) <h2 class="note">
  9. 9.Which of these does HTML do? (a) puts a picture on a page (b) lays out the page (c) shows a pop-up message (d) adds space around boxes
  10. 10.📱 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
  11. 11.📱 max-width: 600px applies when the screen is ___. (a) 600px or wider (b) 600px or narrower (c) exactly 1000px (d) turned off
  12. 12.✍️ Which property is set to 2px solid in this rule?
    #top {
      font-size: 20px;
      border: 2px solid;
    }
    (a) border (b) width (c) font-style (d) 2px solid
  13. 13.🌈 Which colour of light is strongest in rgb(94, 212, 70)? (a) red (b) blue (c) green
  14. 14.🌈 In #rrggbb, which colour do the last two digits give? (a) green (b) white (c) blue (d) red
  15. 15.💪 Which justify-content value puts boxes in the middle? (a) flex-end (b) space-between (c) flex-start (d) center
  16. 16.✍️ What value is given to width in this rule?
    h1 {
      color: red;
      width: 300px;
      font-weight: bold;
      font-size: 20px;
    }
    (a) width (b) italic (c) red (d) 300px
  17. 17.🎯 Can many elements share the same class? (a) Yes (b) No
  18. 18.What does font-family do? (a) centres a heading (b) colours behind the text (c) sets the letter colour (d) picks the font style
  19. 19.🌈 Which hex code is cyan? (a) #ffffff (b) #ff0000 (c) #0000ff (d) #00ffff
  20. 20.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 150px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  21. 21.✍️ What is the selector in this CSS rule?
    .note {
      border: 2px solid;
      padding: 8px;
      color: red;
      background-color: yellow;
    }
    (a) border (b) #top (c) 8px (d) .note
  22. 22.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the first one (b) the later one (c) neither (d) the shorter one
  23. 23.🧩 Which language makes headings and lists? (a) HTML (b) CSS (c) JavaScript
  24. 24.✍️ What is the selector in this CSS rule?
    #top {
      font-size: 20px;
      background-color: yellow;
      margin: 10px;
      text-align: center;
    }
    (a) li (b) #top (c) yellow (d) font-size
  25. 25.🖌️ What colour are the letters?
    p {
      color: red;
      background-color: purple;
      text-align: left;
      font-size: 20px;
    }
    (a) red (b) purple (c) orange
  26. 26.✍️ What value is given to color in this rule?
    #top {
      font-weight: bold;
      color: red;
      padding: 8px;
      border: 2px solid;
    }
    (a) center (b) color (c) 20px (d) red
  27. 27.🔍 Which is the odd one out? (a) makes headings and lists (b) changes the text size (c) rounds box corners (d) adds space around boxes
  28. 28.True or false: margin is a solid or dotted edge. (a) True (b) False
  29. 29.⚖️ What colour is the text of this element?
    <p class="star" id="end">Hi</p>
    CSS:
    .star { color: orange; }
    #end { color: yellow; }
    (a) orange (b) red (c) black (d) yellow
  30. 30.True or false: CSS changes the text size. (a) False (b) True
  31. 31.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 130px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  32. 32.📱 Responsive design means a page ___. (a) is only for laptops (b) fits every screen (c) never changes (d) has no pictures
  33. 33.🎯 Which element does the selector p style? (a) <li id="hero"> (b) <h2 class="box"> (c) <h1> (d) <p class="box">
  34. 34.🖌️ Which CSS property makes the text bold? (a) color (b) font-size (c) font-family (d) font-weight
  35. 35.🎨 A CSS file usually ends with which extension? (a) .css (b) .png (c) .html (d) .js
  36. 36.🖌️ Which CSS property sets the letter colour? (a) text-align (b) background-color (c) color (d) font-weight
  37. 37.🧩 Which language changes the page live? (a) CSS (b) JavaScript (c) HTML
  38. 38.⚖️ Which selector is the weakest? (a) a class selector (b) an id selector (c) an element selector
  39. 39.✍️ In color: blue; which part is the value? (a) : (b) color (c) blue (d) ;
  40. 40.What does color do? (a) sets the letter colour (b) colours behind the text (c) centres a heading (d) makes the text bold

Answer key

  1. CSS
  2. blue
  3. orange
  4. equal gaps, none at ends
  5. True
  6. 40
  7. magenta
  8. <h1 class="star">
  9. puts a picture on a page
  10. the viewport meta tag
  11. 600px or narrower
  12. border
  13. green
  14. blue
  15. center
  16. 300px
  17. Yes
  18. picks the font style
  19. #00ffff
  20. 30
  21. .note
  22. the later one
  23. HTML
  24. #top
  25. red
  26. red
  27. makes headings and lists
  28. False
  29. yellow
  30. True
  31. 10
  32. fits every screen
  33. <p class="box">
  34. font-weight
  35. .css
  36. color
  37. JavaScript
  38. an element selector
  39. blue
  40. sets the letter colour

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