← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 287 · 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.⚖️ What colour is the text of this element?
    <p class="red" id="main">Hi</p>
    CSS:
    .red { color: black; }
    p { color: green; }
    (a) white (b) purple (c) green (d) black
  2. 2.🌈 Which hex code is black? (a) #00ff00 (b) #ffffff (c) #000000 (d) #00ffff
  3. 3.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 190px;
      padding: 20px;
      border: 3px solid black;
      margin: 5px;
    }
  4. 4.⚖️ What colour is the text of this element?
    <p class="star" id="top">Hi</p>
    CSS:
    #top { color: red; }
    .star { color: black; }
    p { color: purple; }
    (a) black (b) red (c) purple (d) white
  5. 5.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 26px;
      }
    }
  6. 6.📱 Responsive design means a page ___. (a) is only for laptops (b) never changes (c) has no pictures (d) fits every screen
  7. 7.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 22px;
      }
    }
  8. 8.Which of these does HTML do? (a) changes the page live (b) makes headings and lists (c) reacts to a button click (d) adds space around boxes
  9. 9.🌈 Which colour of light is strongest in rgb(68, 184, 18)? (a) red (b) blue (c) green
  10. 10.🎯 Which element does the selector .big style? (a) <h2 class="box"> (b) <h1 class="red"> (c) <h1 class="big"> (d) <h1 id="big">
  11. 11.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 12px;
      }
    }
    (a) Yes (b) No
  12. 12.🖌️ Where does the text sit on its line?
    li {
      text-align: left;
      color: yellow;
      font-size: 20px;
      background-color: red;
    }
    (a) on the right (b) in the middle (c) on the left
  13. 13.⚖️ Which selector is the weakest? (a) an id selector (b) a class selector (c) an element selector
  14. 14.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 230px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  15. 15.🎯 What kind of selector is #hero? (a) a class selector (b) an id selector (c) an element selector
  16. 16.⚖️ What colour is the text of this element?
    <h2 class="star" id="intro">Hi</h2>
    CSS:
    h2 { color: red; }
    h2 { color: purple; }
    (a) red (b) purple (c) blue (d) orange
  17. 17.💪 Which flexbox property turns on flexbox? (a) display: flex (b) flex-direction (c) align-items (d) gap
  18. 18.Which of these does HTML do? (a) lays out the page (b) changes the page live (c) shows a pop-up message (d) makes a link
  19. 19.✍️ Which sign goes between a property and its value? (a) ; (b) - (c) = (d) :
  20. 20.🧩 Which language rounds box corners? (a) CSS (b) HTML (c) JavaScript
  21. 21.🌈 Which colour is rgb(255, 255, 255)? (a) cyan (b) magenta (c) red (d) white
  22. 22.🌈 In #rrggbb, which colour do the first two digits give? (a) blue (b) red (c) green (d) black
  23. 23.💪 Which flexbox property sets space between boxes? (a) justify-content (b) gap (c) flex-direction (d) display: flex
  24. 24.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 60px;
      padding: 5px;
      border: 2px solid black;
      margin: 15px;
    }
  25. 25.🌈 Which hex code is white? (a) #0000ff (b) #ffffff (c) #000000 (d) #00ff00
  26. 26.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) the first one (c) the later one (d) neither
  27. 27.True or false: JavaScript makes headings and lists. (a) True (b) False
  28. 28.💪 Which flexbox property lines boxes up across? (a) justify-content (b) gap (c) flex-direction (d) align-items
  29. 29.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 200px;
      justify-content: center;
    }
    Inside are 3 boxes, each 60px wide (no margins).
  30. 30.🎯 Which CSS selector matches this element?
    <h1 class="red" id="logo">Hello</h1>
    (a) h2 (b) .logo (c) .box (d) #logo
  31. 31.⚖️ What colour is the text of this element?
    <p class="big" id="hero">Hi</p>
    CSS:
    p { color: purple; }
    p { color: green; }
    (a) blue (b) black (c) green (d) purple
  32. 32.True or false: margin is the gap to other boxes. (a) False (b) True
  33. 33.⚖️ What colour is the text of this element?
    <p class="big" id="top">Hi</p>
    CSS:
    .big { color: yellow; }
    .big { color: red; }
    (a) orange (b) red (c) yellow (d) blue
  34. 34.True or false: #end is a class selector. (a) True (b) False
  35. 35.🌈 Which colour of light is strongest in rgb(240, 90, 82)? (a) red (b) blue (c) green
  36. 36.🌈 Which hex code is cyan? (a) #ff00ff (b) #ff0000 (c) #00ffff (d) #00ff00
  37. 37.⚖️ What colour is the text of this element?
    <h1 class="menu" id="end">Hi</h1>
    CSS:
    .menu { color: green; }
    h1 { color: black; }
    (a) green (b) white (c) red (d) black
  38. 38.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 140px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  39. 39.🌈 Which colour is rgb(255, 0, 255)? (a) magenta (b) yellow (c) bright green (d) blue
  40. 40.🔍 Which is the odd one out? (a) gives the page structure (b) sets colours and fonts (c) makes headings and lists (d) makes a form box

Answer key

  1. black
  2. #000000
  3. 246
  4. red
  5. 26
  6. fits every screen
  7. 22
  8. makes headings and lists
  9. green
  10. <h1 class="big">
  11. Yes
  12. on the left
  13. an element selector
  14. 30
  15. an id selector
  16. purple
  17. display: flex
  18. makes a link
  19. :
  20. CSS
  21. white
  22. red
  23. gap
  24. 74
  25. #ffffff
  26. the later one
  27. False
  28. align-items
  29. 10
  30. #logo
  31. green
  32. True
  33. red
  34. False
  35. red
  36. #00ffff
  37. green
  38. 40
  39. magenta
  40. sets colours and fonts

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