← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 265 · 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 flexbox property turns on flexbox? (a) display: flex (b) align-items (c) justify-content (d) gap
  2. 2.📱 Responsive design means a page ___. (a) is only for laptops (b) has no pictures (c) never changes (d) fits every screen
  3. 3.🖌️ Which CSS property picks the font style? (a) font-size (b) font-family (c) font-weight (d) background-color
  4. 4.🔍 Which is the odd one out? (a) changes the text size (b) adds space around boxes (c) gives the page structure (d) rounds box corners
  5. 5.✍️ What value is given to width in this rule?
    .box {
      font-style: italic;
      background-color: yellow;
      font-weight: bold;
      width: 300px;
    }
    (a) red (b) width (c) italic (d) 300px
  6. 6.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 28px;
      }
    }
    (a) Yes (b) No
  7. 7.⚖️ What colour is the text of this element?
    <p class="big" id="end">Hi</p>
    CSS:
    #end { color: orange; }
    p { color: yellow; }
    (a) white (b) orange (c) yellow (d) black
  8. 8.🎯 Which CSS selector matches this element?
    <span class="box" id="hero">Hello</span>
    (a) .hero (b) p (c) #top (d) #hero
  9. 9.🎯 Which sign starts an id selector? (a) # (b) & (c) @ (d) .
  10. 10.✍️ What value is given to text-align in this rule?
    p {
      text-align: center;
      color: red;
    }
    (a) yellow (b) 10px (c) center (d) text-align
  11. 11.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 30px;
      }
    }
  12. 12.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 130px;
      padding: 10px;
      border: 4px solid black;
      margin: 0px;
    }
  13. 13.💪 Which flexbox property lines boxes up across? (a) gap (b) justify-content (c) display: flex (d) align-items
  14. 14.🧩 Which language makes headings and lists? (a) HTML (b) JavaScript (c) CSS
  15. 15.⚖️ Which selector is the weakest? (a) a class selector (b) an element selector (c) an id selector
  16. 16.⚖️ What colour is the text of this element?
    <h1 class="box" id="top">Hi</h1>
    CSS:
    #top { color: green; }
    #top { color: orange; }
    (a) yellow (b) purple (c) green (d) orange
  17. 17.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 250px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  18. 18.💪 Which flexbox property picks row or column? (a) gap (b) align-items (c) flex-direction (d) justify-content
  19. 19.🎨 A CSS file usually ends with which extension? (a) .html (b) .css (c) .js (d) .png
  20. 20.🖌️ What colour are the letters?
    h2 {
      text-align: right;
      background-color: black;
      font-size: 12px;
      color: orange;
    }
    (a) yellow (b) orange (c) black
  21. 21.⚖️ What colour is the text of this element?
    <h1 class="note" id="main">Hi</h1>
    CSS:
    .note { color: yellow; }
    #main { color: green; }
    (a) green (b) red (c) yellow (d) white
  22. 22.True or false: HTML adds space around boxes. (a) True (b) False
  23. 23.🌈 In #6f0000 the red part is the hex number 6f. What is it as a normal number?
  24. 24.True or false: margin is the gap round content. (a) False (b) True
  25. 25.🖌️ Where does the text sit on its line?
    p {
      background-color: black;
      font-size: 16px;
      text-align: center;
      color: yellow;
    }
    (a) in the middle (b) on the right (c) on the left
  26. 26.True or false: HTML makes a form box. (a) True (b) False
  27. 27.True or false: .note is a class selector. (a) False (b) True
  28. 28.🎯 What kind of selector is p? (a) an element selector (b) a class selector (c) an id selector
  29. 29.⚖️ What colour is the text of this element?
    <h2 class="note" id="logo">Hi</h2>
    CSS:
    .note { color: red; }
    h2 { color: purple; }
    (a) orange (b) purple (c) red (d) white
  30. 30.✍️ What value is given to font-size in this rule?
    h2 {
      margin: 10px;
      width: 300px;
      border: 2px solid;
      font-size: 20px;
    }
    (a) font-size (b) yellow (c) 20px (d) center
  31. 31.What does background-color do? (a) centres a heading (b) colours behind the text (c) sets the letter colour (d) makes letters bigger
  32. 32.⚖️ What colour is the text of this element?
    <h2 class="red" id="end">Hi</h2>
    CSS:
    #end { color: blue; }
    h2 { color: black; }
    (a) blue (b) yellow (c) green (d) black
  33. 33.🎨 What does CSS stand for? (a) Creative Sheet System (b) Cascading Style Sheets (c) Colourful Site Styles (d) Computer Style Sheets
  34. 34.🖌️ What colour is behind the letters?
    p {
      text-align: left;
      font-size: 20px;
      color: orange;
      background-color: white;
    }
    (a) orange (b) white (c) red
  35. 35.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the first one (b) the later one (c) the shorter one (d) neither
  36. 36.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 16px;
      }
    }
    (a) Yes (b) No
  37. 37.True or false: CSS adds space around boxes. (a) True (b) False
  38. 38.🖌️ Which CSS property sets the letter colour? (a) font-weight (b) font-size (c) color (d) background-color
  39. 39.⚖️ What colour is the text of this element?
    <p class="note" id="logo">Hi</p>
    CSS:
    p { color: red; }
    p { color: purple; }
    (a) yellow (b) purple (c) red (d) blue
  40. 40.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 22px;
      }
    }
    (a) No (b) Yes

Answer key

  1. display: flex
  2. fits every screen
  3. font-family
  4. gives the page structure
  5. 300px
  6. No
  7. orange
  8. #hero
  9. #
  10. center
  11. 30
  12. 158
  13. align-items
  14. HTML
  15. an element selector
  16. orange
  17. 30
  18. flex-direction
  19. .css
  20. orange
  21. green
  22. False
  23. 111
  24. False
  25. in the middle
  26. True
  27. True
  28. an element selector
  29. red
  30. 20px
  31. colours behind the text
  32. blue
  33. Cascading Style Sheets
  34. white
  35. the later one
  36. Yes
  37. True
  38. color
  39. purple
  40. No

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