← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 804 · 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 does font-size do? (a) colours behind the text (b) makes letters bigger (c) picks the font style (d) makes the text bold
  2. 2.What does justify-content: flex-end do? (a) equal gaps, none at ends (b) packs boxes at the start (c) packs boxes at the end (d) puts boxes in the middle
  3. 3.🧩 Which language lays out the page? (a) CSS (b) HTML (c) JavaScript
  4. 4.⚖️ What colour is the text of this element?
    <h2 class="star" id="main">Hi</h2>
    CSS:
    #main { color: yellow; }
    .star { color: black; }
    (a) black (b) purple (c) blue (d) yellow
  5. 5.⚖️ What colour is the text of this element?
    <p class="note" id="logo">Hi</p>
    CSS:
    .note { color: orange; }
    #logo { color: red; }
    p { color: blue; }
    (a) blue (b) red (c) yellow (d) orange
  6. 6.Which of these does JavaScript do? (a) counts down a timer (b) changes the text size (c) gives the page structure (d) makes a link
  7. 7.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the first one (b) neither (c) the shorter one (d) the later one
  8. 8.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 270px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 60px wide (no margins).
  9. 9.🌈 Which colour of light is strongest in rgb(179, 28, 63)? (a) green (b) blue (c) red
  10. 10.🧩 Which language changes the page live? (a) CSS (b) JavaScript (c) HTML
  11. 11.📱 What does a media query check? (a) the time of day (b) the battery level (c) the screen width (d) the page title
  12. 12.✍️ What is the selector in this CSS rule?
    p {
      color: red;
      background-color: yellow;
      border: 2px solid;
    }
    (a) color (b) .note (c) p (d) yellow
  13. 13.🖌️ What colour are the letters?
    li {
      text-align: left;
      font-size: 32px;
      color: white;
      background-color: yellow;
    }
    (a) yellow (b) white (c) red
  14. 14.🎯 Which sign starts an id selector? (a) @ (b) # (c) & (d) .
  15. 15.True or false: CSS lays out the page. (a) False (b) True
  16. 16.📱 min-width: 800px applies when the screen is ___. (a) turned off (b) exactly 100px (c) 800px or wider (d) 800px or narrower
  17. 17.⚖️ Which selector is the strongest? (a) a class selector (b) an element selector (c) an id selector
  18. 18.⚖️ What colour is the text of this element?
    <p class="note" id="hero">Hi</p>
    CSS:
    #hero { color: yellow; }
    .note { color: purple; }
    p { color: orange; }
    (a) yellow (b) blue (c) purple (d) orange
  19. 19.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 140px;
      padding: 15px;
      border: 2px solid black;
      margin: 15px;
    }
  20. 20.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 160px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  21. 21.💪 Which justify-content value puts boxes in the middle? (a) flex-start (b) flex-end (c) center (d) space-between
  22. 22.💪 Which justify-content value equal gaps, none at ends? (a) flex-end (b) space-between (c) center (d) flex-start
  23. 23.🌈 Which colour is rgb(255, 0, 255)? (a) yellow (b) black (c) white (d) magenta
  24. 24.🌈 Which colour of light is strongest in rgb(15, 107, 230)? (a) blue (b) green (c) red
  25. 25.🎨 One CSS file can style how many pages? (a) no pages (b) only one word (c) only one image (d) many pages
  26. 26.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 30px;
      }
    }
  27. 27.Which of these is padding? (a) the gap round content (b) the gap to other boxes (c) the text or picture (d) the line round the box
  28. 28.🌈 Which colour is #00ffff? (a) magenta (b) blue (c) black (d) cyan
  29. 29.🎨 Which tag connects an outside CSS file? (a) <a> (b) <img> (c) <css> (d) <link>
  30. 30.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 3 (b) 2 (c) 4 (d) 6
  31. 31.🌈 Which colour is rgb(255, 255, 0)? (a) magenta (b) yellow (c) bright green (d) black
  32. 32.💪 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 40px wide (no margins).
  33. 33.🖌️ Which CSS property picks the font style? (a) font-weight (b) font-family (c) color (d) font-size
  34. 34.🎯 Can many elements share the same class? (a) No (b) Yes
  35. 35.🌈 Which colour of light is strongest in rgb(154, 100, 31)? (a) red (b) blue (c) green
  36. 36.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 70px;
      padding: 15px;
      border: 4px solid black;
      margin: 5px;
    }
  37. 37.🌈 Which hex code is white? (a) #00ff00 (b) #ff0000 (c) #00ffff (d) #ffffff
  38. 38.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 140px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  39. 39.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 22px;
      }
    }
  40. 40.🎯 Which element does the selector #hero style? (a) <p id="top"> (b) <p class="hero"> (c) <p id="hero"> (d) <h1 class="box">

Answer key

  1. makes letters bigger
  2. packs boxes at the end
  3. CSS
  4. yellow
  5. red
  6. counts down a timer
  7. the later one
  8. 30
  9. red
  10. JavaScript
  11. the screen width
  12. p
  13. white
  14. #
  15. True
  16. 800px or wider
  17. an id selector
  18. yellow
  19. 204
  20. 60
  21. center
  22. space-between
  23. magenta
  24. blue
  25. many pages
  26. 24
  27. the gap round content
  28. cyan
  29. <link>
  30. 3
  31. yellow
  32. 70
  33. font-family
  34. Yes
  35. red
  36. 118
  37. #ffffff
  38. 20
  39. 24
  40. <p id="hero">

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