← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 639 · 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 is the odd one out? (a) makes a form box (b) shows a pop-up message (c) puts a picture on a page (d) gives the page structure
  2. 2.✍️ Which property is set to red in this rule?
    body {
      text-align: center;
      font-size: 20px;
      color: red;
    }
    (a) color (b) font-size (c) text-align (d) red
  3. 3.⚖️ What colour is the text of this element?
    <h1 class="menu" id="main">Hi</h1>
    CSS:
    .menu { color: red; }
    .menu { color: yellow; }
    (a) orange (b) red (c) yellow (d) green
  4. 4.📱 min-width: 800px applies when the screen is ___. (a) turned off (b) exactly 100px (c) 800px or narrower (d) 800px or wider
  5. 5.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 26px;
      }
    }
  6. 6.🌈 Which colour of light is strongest in rgb(129, 68, 171)? (a) green (b) red (c) blue
  7. 7.True or false: #logo is an id selector. (a) True (b) False
  8. 8.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 6px;
      }
    }
  9. 9.True or false: the content is space outside the border. (a) True (b) False
  10. 10.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 80px;
      padding: 10px;
      border: 3px solid black;
      margin: 5px;
    }
  11. 11.🧩 Which language makes headings and lists? (a) CSS (b) JavaScript (c) HTML
  12. 12.True or false: padding is the gap round content. (a) False (b) True
  13. 13.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 170px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  14. 14.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 26px;
      }
    }
    (a) No (b) Yes
  15. 15.🎨 Which tag connects an outside CSS file? (a) <img> (b) <link> (c) <css> (d) <a>
  16. 16.What does justify-content: flex-start do? (a) packs boxes at the end (b) packs boxes at the start (c) equal gaps, none at ends (d) puts boxes in the middle
  17. 17.🎯 What kind of selector is li? (a) an id selector (b) a class selector (c) an element selector
  18. 18.⚖️ Which selector is the weakest? (a) an id selector (b) a class selector (c) an element selector
  19. 19.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 12px;
      }
    }
    (a) No (b) Yes
  20. 20.✍️ Which property is set to 10px in this rule?
    h2 {
      margin: 10px;
      font-weight: bold;
    }
    (a) font-weight (b) padding (c) margin (d) 10px
  21. 21.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 30px;
      }
    }
    (a) Yes (b) No
  22. 22.⚖️ What colour is the text of this element?
    <h1 class="red" id="logo">Hi</h1>
    CSS:
    .red { color: red; }
    #logo { color: white; }
    h1 { color: blue; }
    (a) white (b) blue (c) black (d) red
  23. 23.🌈 Which colour is rgb(0, 0, 255)? (a) red (b) blue (c) white (d) magenta
  24. 24.⚖️ What colour is the text of this element?
    <p class="menu" id="logo">Hi</p>
    CSS:
    .menu { color: white; }
    .menu { color: orange; }
    (a) orange (b) black (c) white (d) purple
  25. 25.📦 In the box model, which part is the text or picture? (a) margin (b) border (c) content (d) padding
  26. 26.💪 Which justify-content value equal gaps, none at ends? (a) flex-start (b) flex-end (c) space-between (d) center
  27. 27.🔍 Which is the odd one out? (a) lays out the page (b) reacts to a button click (c) sets colours and fonts (d) rounds box corners
  28. 28.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 50px;
      padding: 20px;
      border: 5px solid black;
      margin: 15px;
    }
  29. 29.⚖️ What colour is the text of this element?
    <h1 class="note" id="logo">Hi</h1>
    CSS:
    .note { color: green; }
    h1 { color: yellow; }
    (a) white (b) green (c) black (d) yellow
  30. 30.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 80px;
      padding: 25px;
      border: 3px solid black;
      margin: 10px;
    }
  31. 31.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 190px;
      padding: 20px;
      border: 1px solid black;
      margin: 10px;
    }
  32. 32.🖌️ Which CSS property picks the font style? (a) color (b) text-align (c) font-size (d) font-family
  33. 33.✍️ Which sign goes between a property and its value? (a) ; (b) = (c) : (d) -
  34. 34.True or false: #main is a class selector. (a) True (b) False
  35. 35.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 160px;
      justify-content: center;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  36. 36.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the later one (b) the shorter one (c) the first one (d) neither
  37. 37.Which of these does HTML do? (a) reacts to a button click (b) makes a form box (c) shows a pop-up message (d) changes the page live
  38. 38.⚖️ What colour is the text of this element?
    <h2 class="box" id="intro">Hi</h2>
    CSS:
    #intro { color: blue; }
    #intro { color: orange; }
    (a) blue (b) orange (c) green (d) purple
  39. 39.🖌️ What colour are the letters?
    li {
      font-size: 32px;
      text-align: left;
      color: blue;
      background-color: white;
    }
    (a) blue (b) red (c) white
  40. 40.🎨 One CSS file can style how many pages? (a) no pages (b) many pages (c) only one word (d) only one image

Answer key

  1. shows a pop-up message
  2. color
  3. yellow
  4. 800px or wider
  5. 26
  6. blue
  7. True
  8. 12
  9. False
  10. 116
  11. HTML
  12. True
  13. 70
  14. No
  15. <link>
  16. packs boxes at the start
  17. an element selector
  18. an element selector
  19. No
  20. margin
  21. Yes
  22. white
  23. blue
  24. orange
  25. content
  26. space-between
  27. reacts to a button click
  28. 130
  29. green
  30. 156
  31. 252
  32. font-family
  33. :
  34. False
  35. 20
  36. the later one
  37. makes a form box
  38. orange
  39. blue
  40. many pages

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