← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 402 · 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 puts a picture on a page? (a) HTML (b) CSS (c) JavaScript
  2. 2.✍️ How does a CSS comment start? (a) # (b) <!-- (c) /* (d) //
  3. 3.⚖️ Which selector is the weakest? (a) a class selector (b) an id selector (c) an element selector
  4. 4.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the later one (b) neither (c) the shorter one (d) the first one
  5. 5.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 170px;
      padding: 25px;
      border: 4px solid black;
      margin: 0px;
    }
  6. 6.📱 Responsive design means a page ___. (a) is only for laptops (b) has no pictures (c) fits every screen (d) never changes
  7. 7.⚖️ What colour is the text of this element?
    <h2 class="star" id="logo">Hi</h2>
    CSS:
    h2 { color: black; }
    h2 { color: yellow; }
    (a) green (b) black (c) yellow (d) blue
  8. 8.🌈 Which colour is #0000ff? (a) cyan (b) blue (c) white (d) black
  9. 9.🖌️ What colour are the letters?
    h1 {
      color: orange;
      font-size: 20px;
      background-color: yellow;
      text-align: left;
    }
    (a) black (b) orange (c) yellow
  10. 10.🖌️ Which CSS property colours behind the text? (a) font-weight (b) font-family (c) background-color (d) text-align
  11. 11.🎯 Which CSS selector matches this element?
    <p class="note" id="top">Hello</p>
    (a) h1 (b) p (c) .top (d) #note
  12. 12.⚖️ What colour is the text of this element?
    <h2 class="star" id="intro">Hi</h2>
    CSS:
    .star { color: yellow; }
    h2 { color: blue; }
    (a) blue (b) purple (c) red (d) yellow
  13. 13.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 8px;
      }
    }
  14. 14.🖌️ Where does the text sit on its line?
    p {
      text-align: center;
      background-color: orange;
      color: blue;
      font-size: 36px;
    }
    (a) on the right (b) in the middle (c) on the left
  15. 15.🖌️ Where does the text sit on its line?
    h2 {
      background-color: orange;
      font-size: 16px;
      text-align: left;
      color: purple;
    }
    (a) on the right (b) in the middle (c) on the left
  16. 16.🌈 Which colour of light is strongest in rgb(10, 189, 90)? (a) green (b) red (c) blue
  17. 17.What does justify-content: flex-end do? (a) puts boxes in the middle (b) equal gaps, none at ends (c) packs boxes at the end (d) packs boxes at the start
  18. 18.True or false: the border is the line round the box. (a) False (b) True
  19. 19.🎨 Which tag connects an outside CSS file? (a) <link> (b) <img> (c) <a> (d) <css>
  20. 20.🖌️ Which CSS property picks the font style? (a) background-color (b) color (c) font-family (d) font-size
  21. 21.💪 Which justify-content value packs boxes at the end? (a) space-between (b) center (c) flex-end (d) flex-start
  22. 22.🎯 Which element does the selector .menu style? (a) <div class="menu"> (b) <div id="menu"> (c) <div class="note"> (d) <span class="big">
  23. 23.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 40px;
      padding: 30px;
      border: 5px solid black;
      margin: 5px;
    }
  24. 24.Which of these does HTML do? (a) rounds box corners (b) reacts to a button click (c) makes headings and lists (d) lays out the page
  25. 25.🔍 Which is the odd one out? (a) rounds box corners (b) adds space around boxes (c) makes headings and lists (d) sets colours and fonts
  26. 26.🖌️ How big is the text, in px?
    p {
      font-size: 24px;
      background-color: white;
      text-align: left;
      color: blue;
    }
  27. 27.✍️ How many declarations (property: value pairs) are in this rule?
    body {
      font-weight: bold;
      width: 300px;
    }
  28. 28.🌈 Which colour is rgb(255, 255, 255)? (a) magenta (b) yellow (c) red (d) white
  29. 29.💪 Which flexbox property picks row or column? (a) flex-direction (b) justify-content (c) align-items (d) display: flex
  30. 30.✍️ Which property is set to 20px in this rule?
    body {
      font-size: 20px;
      text-align: center;
    }
    (a) background-color (b) font-size (c) text-align (d) 20px
  31. 31.Which of these does HTML do? (a) changes the text size (b) puts a picture on a page (c) adds space around boxes (d) sets colours and fonts
  32. 32.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 360px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 100px wide (no margins).
  33. 33.🎯 Which element does the selector span style? (a) <h1 class="note"> (b) <span class="note"> (c) <p> (d) <h2 id="intro">
  34. 34.🎯 Which element does the selector #intro style? (a) <div class="intro"> (b) <div id="intro"> (c) <span class="big"> (d) <div id="main">
  35. 35.🌈 Which colour of light is strongest in rgb(39, 46, 223)? (a) red (b) blue (c) green
  36. 36.🎯 Can many elements share the same class? (a) Yes (b) No
  37. 37.✍️ Which property is set to 20px in this rule?
    .box {
      background-color: yellow;
      font-style: italic;
      font-weight: bold;
      font-size: 20px;
    }
    (a) text-align (b) font-size (c) 20px (d) background-color
  38. 38.🌈 Which hex code is yellow? (a) #ffffff (b) #ffff00 (c) #00ff00 (d) #000000
  39. 39.🌈 In #630000 the red part is the hex number 63. What is it as a normal number?
  40. 40.📱 What does a media query check? (a) the page title (b) the battery level (c) the time of day (d) the screen width

Answer key

  1. HTML
  2. /*
  3. an element selector
  4. the later one
  5. 228
  6. fits every screen
  7. yellow
  8. blue
  9. orange
  10. background-color
  11. p
  12. yellow
  13. 8
  14. in the middle
  15. on the left
  16. green
  17. packs boxes at the end
  18. True
  19. <link>
  20. font-family
  21. flex-end
  22. <div class="menu">
  23. 120
  24. makes headings and lists
  25. makes headings and lists
  26. 24
  27. 2
  28. white
  29. flex-direction
  30. font-size
  31. puts a picture on a page
  32. 60
  33. <span class="note">
  34. <div id="intro">
  35. blue
  36. Yes
  37. font-size
  38. #ffff00
  39. 99
  40. the screen width

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