← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 760 · 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.📱 The screen is 1366px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 28px;
      }
    }
    (a) No (b) Yes
  2. 2.🧩 Which language makes headings and lists? (a) JavaScript (b) CSS (c) HTML
  3. 3.True or false: CSS lays out the page. (a) True (b) False
  4. 4.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 16px;
      }
    }
    (a) Yes (b) No
  5. 5.🌈 In #110000 the red part is the hex number 11. What is it as a normal number?
  6. 6.✍️ In color: blue; which part is the value? (a) ; (b) color (c) : (d) blue
  7. 7.🌈 Which colour is rgb(0, 255, 255)? (a) red (b) yellow (c) cyan (d) bright green
  8. 8.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 14px;
      }
    }
  9. 9.✍️ What is the selector in this CSS rule?
    .note {
      font-style: italic;
      text-align: center;
      color: red;
    }
    (a) center (b) #top (c) font-style (d) .note
  10. 10.🧩 Which language makes a link? (a) HTML (b) JavaScript (c) CSS
  11. 11.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 130px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  12. 12.Which of these is padding? (a) space outside the border (b) a solid or dotted edge (c) the text or picture (d) the gap round content
  13. 13.What does color do? (a) picks the font style (b) centres a heading (c) makes the text bold (d) sets the letter colour
  14. 14.⚖️ What colour is the text of this element?
    <p class="red" id="hero">Hi</p>
    CSS:
    .red { color: purple; }
    .red { color: yellow; }
    (a) red (b) purple (c) yellow (d) white
  15. 15.🌈 In #0000f6 the blue part is the hex number f6. What is it as a normal number?
  16. 16.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 170px;
      padding: 15px;
      border: 2px solid black;
      margin: 5px;
    }
  17. 17.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 10px;
      }
    }
  18. 18.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      color: red;
    }
  19. 19.✍️ How does a CSS comment start? (a) <!-- (b) # (c) // (d) /*
  20. 20.True or false: li is an element selector. (a) True (b) False
  21. 21.🌈 In #5d0000 the red part is the hex number 5d. What is it as a normal number?
  22. 22.🖌️ Which CSS property sets the letter colour? (a) font-size (b) text-align (c) font-family (d) color
  23. 23.⚖️ Which selector is the strongest? (a) a class selector (b) an id selector (c) an element selector
  24. 24.True or false: body is an element selector. (a) False (b) True
  25. 25.⚖️ What colour is the text of this element?
    <p class="box" id="main">Hi</p>
    CSS:
    p { color: white; }
    .box { color: orange; }
    (a) purple (b) red (c) white (d) orange
  26. 26.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 6px;
      }
    }
    (a) Yes (b) No
  27. 27.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      font-style: italic;
      margin: 10px;
      padding: 8px;
    }
  28. 28.🌈 In #cb0000 the red part is the hex number cb. What is it as a normal number?
  29. 29.🎯 Which CSS selector matches this element?
    <li class="star" id="logo">Hello</li>
    (a) li (b) div (c) #star (d) .logo
  30. 30.🎯 Which CSS selector matches this element?
    <h2 class="box" id="logo">Hello</h2>
    (a) h2 (b) #box (c) .star (d) .logo
  31. 31.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 22px;
      }
    }
    (a) Yes (b) No
  32. 32.✍️ CSS declarations go inside which brackets? (a) ( ) (b) < > (c) [ ] (d) { }
  33. 33.What does font-family do? (a) picks the font style (b) colours behind the text (c) sets the letter colour (d) makes letters bigger
  34. 34.🔍 Which is the odd one out? (a) lays out the page (b) makes a link (c) changes the text size (d) rounds box corners
  35. 35.✍️ What value is given to text-align in this rule?
    h2 {
      border: 2px solid;
      text-align: center;
      font-size: 20px;
    }
    (a) text-align (b) center (c) yellow (d) 10px
  36. 36.🔍 Which is the odd one out? (a) sets colours and fonts (b) rounds box corners (c) gives the page structure (d) lays out the page
  37. 37.True or false: #end is an id selector. (a) False (b) True
  38. 38.⚖️ Two rules with the same selector set a colour. Which one wins? (a) neither (b) the first one (c) the later one (d) the shorter one
  39. 39.🎯 How many elements on a page should have the same id? (a) 5 (b) any number (c) 1 (d) 2
  40. 40.✍️ In color: blue; which part is the property? (a) color (b) ; (c) : (d) blue

Answer key

  1. Yes
  2. HTML
  3. True
  4. Yes
  5. 17
  6. blue
  7. cyan
  8. 14
  9. .note
  10. HTML
  11. 50
  12. the gap round content
  13. sets the letter colour
  14. yellow
  15. 246
  16. 214
  17. 12
  18. 1
  19. /*
  20. True
  21. 93
  22. color
  23. an id selector
  24. True
  25. orange
  26. Yes
  27. 3
  28. 203
  29. li
  30. h2
  31. Yes
  32. { }
  33. picks the font style
  34. makes a link
  35. center
  36. gives the page structure
  37. True
  38. the later one
  39. 1
  40. color

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