← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 88 · 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.True or false: p is an element selector. (a) False (b) True
  2. 2.True or false: CSS gives the page structure. (a) False (b) True
  3. 3.⚖️ What colour is the text of this element?
    <p class="red" id="top">Hi</p>
    CSS:
    #top { color: green; }
    #top { color: red; }
    (a) black (b) red (c) green (d) purple
  4. 4.🌈 Which colour is #00ff00? (a) cyan (b) black (c) bright green (d) blue
  5. 5.True or false: #main is a class selector. (a) True (b) False
  6. 6.⚖️ What colour is the text of this element?
    <p class="box" id="end">Hi</p>
    CSS:
    p { color: red; }
    .box { color: orange; }
    #end { color: white; }
    (a) white (b) orange (c) green (d) red
  7. 7.🌈 Which colour is rgb(0, 255, 0)? (a) blue (b) black (c) bright green (d) yellow
  8. 8.💪 Which justify-content value puts boxes in the middle? (a) space-between (b) flex-end (c) center (d) flex-start
  9. 9.🔍 Which is the odd one out? (a) gives the page structure (b) makes a form box (c) changes the text size (d) makes a link
  10. 10.🎯 Which CSS selector matches this element?
    <p class="box" id="top">Hello</p>
    (a) h1 (b) #box (c) .star (d) .box
  11. 11.🎯 Which CSS selector matches this element?
    <h1 class="note" id="end">Hello</h1>
    (a) h2 (b) .big (c) .end (d) .note
  12. 12.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 20px;
      }
    }
  13. 13.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 10px;
      }
    }
    (a) Yes (b) No
  14. 14.⚖️ What colour is the text of this element?
    <h2 class="menu" id="main">Hi</h2>
    CSS:
    h2 { color: red; }
    h2 { color: green; }
    (a) red (b) yellow (c) black (d) green
  15. 15.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      text-align: center;
      margin: 10px;
      padding: 8px;
    }
  16. 16.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 22px;
      }
    }
  17. 17.🎯 Which CSS selector matches this element?
    <p class="menu" id="intro">Hello</p>
    (a) #menu (b) #intro (c) .note (d) .intro
  18. 18.✍️ Which property is set to center in this rule?
    body {
      color: red;
      font-size: 20px;
      text-align: center;
    }
    (a) center (b) background-color (c) text-align (d) margin
  19. 19.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 20px;
      }
    }
  20. 20.⚖️ What colour is the text of this element?
    <p class="red" id="logo">Hi</p>
    CSS:
    .red { color: blue; }
    #logo { color: purple; }
    (a) purple (b) orange (c) blue (d) white
  21. 21.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 180px;
      padding: 30px;
      border: 5px solid black;
      margin: 0px;
    }
  22. 22.🔍 Which is the odd one out? (a) checks a quiz answer (b) makes headings and lists (c) counts down a timer (d) changes the page live
  23. 23.🖌️ Which CSS property colours behind the text? (a) font-family (b) background-color (c) color (d) text-align
  24. 24.🎨 Which tag connects an outside CSS file? (a) <img> (b) <link> (c) <a> (d) <css>
  25. 25.✍️ What is the selector in this CSS rule?
    p {
      border: 2px solid;
      color: red;
      padding: 8px;
      font-weight: bold;
    }
    (a) border (b) red (c) p (d) .note
  26. 26.🌈 Which colour of light is strongest in rgb(37, 195, 138)? (a) blue (b) green (c) red
  27. 27.Which of these does JavaScript do? (a) makes a form box (b) changes the text size (c) makes headings and lists (d) checks a quiz answer
  28. 28.✍️ Which sign ends each CSS declaration? (a) : (b) ; (c) , (d) .
  29. 29.🎯 Which element does the selector #top style? (a) <h1 id="top"> (b) <h2 class="menu"> (c) <h1 class="top"> (d) <h1 id="intro">
  30. 30.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the later one (b) the first one (c) the shorter one (d) neither
  31. 31.🌈 Which colour is #00ffff? (a) bright green (b) cyan (c) yellow (d) white
  32. 32.True or false: CSS makes headings and lists. (a) True (b) False
  33. 33.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 10px;
      }
    }
  34. 34.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 200px;
      justify-content: center;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  35. 35.🧩 Which language makes a form box? (a) JavaScript (b) CSS (c) HTML
  36. 36.True or false: p is an id selector. (a) True (b) False
  37. 37.🌈 Which colour is rgb(255, 255, 255)? (a) black (b) red (c) blue (d) white
  38. 38.📱 Responsive design means a page ___. (a) fits every screen (b) has no pictures (c) never changes (d) is only for laptops
  39. 39.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 18px;
      }
    }
    (a) No (b) Yes
  40. 40.🎯 Which element does the selector .note style? (a) <span class="red"> (b) <div class="note"> (c) <div class="big"> (d) <div id="note">

Answer key

  1. True
  2. False
  3. red
  4. bright green
  5. False
  6. white
  7. bright green
  8. center
  9. changes the text size
  10. .box
  11. .note
  12. 20
  13. Yes
  14. green
  15. 3
  16. 22
  17. #intro
  18. text-align
  19. 24
  20. purple
  21. 250
  22. makes headings and lists
  23. background-color
  24. <link>
  25. p
  26. green
  27. checks a quiz answer
  28. ;
  29. <h1 id="top">
  30. the later one
  31. cyan
  32. False
  33. 10
  34. 50
  35. HTML
  36. False
  37. white
  38. fits every screen
  39. Yes
  40. <div class="note">

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