← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 616 · 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.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 100px;
      padding: 30px;
      border: 2px solid black;
      margin: 5px;
    }
  2. 2.✍️ How does a CSS comment start? (a) // (b) /* (c) <!-- (d) #
  3. 3.🌈 In #920000 the red part is the hex number 92. What is it as a normal number?
  4. 4.🎯 Which element does the selector .menu style? (a) <h1 class="menu"> (b) <h1 class="note"> (c) <h2 class="big"> (d) <h1 id="menu">
  5. 5.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 90px;
      padding: 10px;
      border: 1px solid black;
      margin: 15px;
    }
  6. 6.📱 What does a media query check? (a) the time of day (b) the page title (c) the battery level (d) the screen width
  7. 7.✍️ Which property is set to 2px solid in this rule?
    p {
      border: 2px solid;
      font-weight: bold;
    }
    (a) border (b) 2px solid (c) font-style (d) width
  8. 8.🖌️ What colour are the letters?
    li {
      text-align: left;
      font-size: 24px;
      color: green;
      background-color: red;
    }
    (a) green (b) red (c) blue
  9. 9.🔍 Which is the odd one out? (a) counts down a timer (b) makes a form box (c) shows a pop-up message (d) checks a quiz answer
  10. 10.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the first one (b) neither (c) the shorter one (d) the later one
  11. 11.⚖️ What colour is the text of this element?
    <p class="red" id="intro">Hi</p>
    CSS:
    p { color: red; }
    p { color: black; }
    (a) black (b) blue (c) red (d) yellow
  12. 12.🧩 Which language checks a quiz answer? (a) HTML (b) JavaScript (c) CSS
  13. 13.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 8px;
      }
    }
  14. 14.📦 In the box model, which part is space outside the border? (a) margin (b) padding (c) content (d) border
  15. 15.🖌️ What colour is behind the letters?
    h1 {
      text-align: center;
      color: white;
      background-color: purple;
      font-size: 32px;
    }
    (a) black (b) purple (c) white
  16. 16.🖌️ What colour is behind the letters?
    li {
      text-align: left;
      font-size: 40px;
      color: red;
      background-color: white;
    }
    (a) white (b) red (c) yellow
  17. 17.🎯 Can many elements share the same class? (a) No (b) Yes
  18. 18.What does text-align do? (a) picks the font style (b) centres a heading (c) sets the letter colour (d) makes the text bold
  19. 19.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 60px;
      padding: 10px;
      border: 4px solid black;
      margin: 5px;
    }
  20. 20.⚖️ Which selector is the strongest? (a) an element selector (b) an id selector (c) a class selector
  21. 21.🌈 Which colour is rgb(0, 0, 255)? (a) blue (b) magenta (c) red (d) black
  22. 22.🌈 In #rrggbb, which colour do the first two digits give? (a) blue (b) black (c) green (d) red
  23. 23.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 22px;
      }
    }
  24. 24.🧩 Which language reacts to a button click? (a) HTML (b) JavaScript (c) CSS
  25. 25.📦 In the box model, which part is the line round the box? (a) content (b) padding (c) border (d) margin
  26. 26.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 120px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  27. 27.🧩 Which language shows a pop-up message? (a) JavaScript (b) HTML (c) CSS
  28. 28.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 480px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 100px wide (no margins).
  29. 29.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      font-size: 20px;
    }
  30. 30.🌈 In #004000 the green part is the hex number 40. What is it as a normal number?
  31. 31.What does color do? (a) makes the text bold (b) makes letters bigger (c) picks the font style (d) sets the letter colour
  32. 32.⚖️ What colour is the text of this element?
    <h1 class="menu" id="intro">Hi</h1>
    CSS:
    h1 { color: white; }
    h1 { color: orange; }
    (a) red (b) white (c) blue (d) orange
  33. 33.Which of these does JavaScript do? (a) lays out the page (b) makes headings and lists (c) reacts to a button click (d) adds space around boxes
  34. 34.Which of these does HTML do? (a) makes a link (b) lays out the page (c) checks a quiz answer (d) reacts to a button click
  35. 35.🌈 In #c30000 the red part is the hex number c3. What is it as a normal number?
  36. 36.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 20px;
      }
    }
  37. 37.🎯 What kind of selector is p? (a) an element selector (b) an id selector (c) a class selector
  38. 38.🌈 Which colour is #00ff00? (a) red (b) magenta (c) blue (d) bright green
  39. 39.💪 Which flexbox property turns on flexbox? (a) align-items (b) justify-content (c) gap (d) display: flex
  40. 40.⚖️ What colour is the text of this element?
    <h2 class="note" id="main">Hi</h2>
    CSS:
    #main { color: blue; }
    #main { color: green; }
    (a) white (b) green (c) yellow (d) blue

Answer key

  1. 174
  2. /*
  3. 146
  4. <h1 class="menu">
  5. 142
  6. the screen width
  7. border
  8. green
  9. makes a form box
  10. the later one
  11. black
  12. JavaScript
  13. 12
  14. margin
  15. purple
  16. white
  17. Yes
  18. centres a heading
  19. 98
  20. an id selector
  21. blue
  22. red
  23. 16
  24. JavaScript
  25. border
  26. 40
  27. JavaScript
  28. 80
  29. 1
  30. 64
  31. sets the letter colour
  32. orange
  33. reacts to a button click
  34. makes a link
  35. 195
  36. 20
  37. an element selector
  38. bright green
  39. display: flex
  40. green

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