← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 865 · 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 375px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 18px;
      }
    }
    (a) No (b) Yes
  2. 2.⚖️ What colour is the text of this element?
    <h1 class="star" id="hero">Hi</h1>
    CSS:
    #hero { color: green; }
    #hero { color: red; }
    (a) red (b) blue (c) black (d) green
  3. 3.⚖️ What colour is the text of this element?
    <p class="note" id="main">Hi</p>
    CSS:
    p { color: red; }
    p { color: white; }
    (a) red (b) green (c) black (d) white
  4. 4.⚖️ Which selector is the strongest? (a) an element selector (b) a class selector (c) an id selector
  5. 5.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 300px;
      justify-content: space-between;
    }
    Inside are 3 boxes, each 60px wide (no margins).
  6. 6.🖌️ What colour are the letters?
    h1 {
      text-align: right;
      background-color: red;
      color: orange;
      font-size: 36px;
    }
    (a) purple (b) orange (c) red
  7. 7.True or false: JavaScript sets colours and fonts. (a) True (b) False
  8. 8.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 6px;
      }
    }
    (a) Yes (b) No
  9. 9.🎨 What does CSS stand for? (a) Computer Style Sheets (b) Creative Sheet System (c) Cascading Style Sheets (d) Colourful Site Styles
  10. 10.🌈 In #0000d1 the blue part is the hex number d1. What is it as a normal number?
  11. 11.🎨 One CSS file can style how many pages? (a) many pages (b) only one image (c) only one word (d) no pages
  12. 12.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 260px;
      padding: 5px;
      border: 4px solid black;
      margin: 0px;
    }
  13. 13.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 320px;
      justify-content: center;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  14. 14.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 110px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  15. 15.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 100px;
      padding: 5px;
      border: 2px solid black;
      margin: 15px;
    }
  16. 16.True or false: #hero is an id selector. (a) True (b) False
  17. 17.True or false: p is an id selector. (a) True (b) False
  18. 18.📱 Which tag helps phones show a page at the right size? (a) the hr tag (b) the title tag (c) the br tag (d) the viewport meta tag
  19. 19.What does text-align do? (a) sets the letter colour (b) colours behind the text (c) picks the font style (d) centres a heading
  20. 20.🎯 What kind of selector is p? (a) an id selector (b) a class selector (c) an element selector
  21. 21.🧩 Which language makes a link? (a) CSS (b) HTML (c) JavaScript
  22. 22.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 8px;
      }
    }
  23. 23.⚖️ What colour is the text of this element?
    <h1 class="star" id="top">Hi</h1>
    CSS:
    .star { color: black; }
    .star { color: blue; }
    (a) green (b) blue (c) black (d) white
  24. 24.✍️ What value is given to text-align in this rule?
    .box {
      width: 300px;
      text-align: center;
      font-size: 20px;
    }
    (a) center (b) 10px (c) text-align (d) yellow
  25. 25.⚖️ What colour is the text of this element?
    <h2 class="note" id="end">Hi</h2>
    CSS:
    h2 { color: orange; }
    h2 { color: blue; }
    (a) blue (b) orange (c) purple (d) white
  26. 26.🌈 Which colour is rgb(0, 0, 0)? (a) cyan (b) bright green (c) black (d) blue
  27. 27.🎯 Which element does the selector h1 style? (a) <div id="main"> (b) <h1 class="note"> (c) <h2> (d) <li class="note">
  28. 28.🎯 What kind of selector is h1? (a) a class selector (b) an id selector (c) an element selector
  29. 29.🎯 Which element does the selector .red style? (a) <h2 class="star"> (b) <h1 class="box"> (c) <h1 id="red"> (d) <h1 class="red">
  30. 30.💪 Which justify-content value packs boxes at the end? (a) flex-end (b) flex-start (c) center (d) space-between
  31. 31.⚖️ Which selector is the weakest? (a) a class selector (b) an id selector (c) an element selector
  32. 32.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 22px;
      }
    }
    (a) Yes (b) No
  33. 33.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 320px;
      justify-content: space-between;
    }
    Inside are 3 boxes, each 60px wide (no margins).
  34. 34.📱 max-width: 600px applies when the screen is ___. (a) 600px or wider (b) turned off (c) exactly 1000px (d) 600px or narrower
  35. 35.What does justify-content: center do? (a) puts boxes in the middle (b) packs boxes at the end (c) packs boxes at the start (d) equal gaps, none at ends
  36. 36.📱 What does a media query check? (a) the screen width (b) the page title (c) the time of day (d) the battery level
  37. 37.🧩 Which language counts down a timer? (a) JavaScript (b) HTML (c) CSS
  38. 38.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      border: 2px solid;
    }
  39. 39.What does justify-content: space-between do? (a) equal gaps, none at ends (b) packs boxes at the end (c) packs boxes at the start (d) puts boxes in the middle
  40. 40.🧩 Which language changes the page live? (a) HTML (b) CSS (c) JavaScript

Answer key

  1. No
  2. red
  3. white
  4. an id selector
  5. 60
  6. orange
  7. False
  8. Yes
  9. Cascading Style Sheets
  10. 209
  11. many pages
  12. 278
  13. 80
  14. 30
  15. 144
  16. True
  17. False
  18. the viewport meta tag
  19. centres a heading
  20. an element selector
  21. HTML
  22. 8
  23. blue
  24. center
  25. blue
  26. black
  27. <h1 class="note">
  28. an element selector
  29. <h1 class="red">
  30. flex-end
  31. an element selector
  32. Yes
  33. 70
  34. 600px or narrower
  35. puts boxes in the middle
  36. the screen width
  37. JavaScript
  38. 1
  39. equal gaps, none at ends
  40. JavaScript

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