← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 925 · 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="end">Hi</p>
    CSS:
    .red { color: green; }
    p { color: yellow; }
    #end { color: purple; }
    (a) purple (b) red (c) green (d) yellow
  2. 2.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 22px;
      }
    }
  3. 3.🎯 Which sign starts an id selector? (a) @ (b) & (c) # (d) .
  4. 4.🌈 In #rrggbb, which colour do the first two digits give? (a) blue (b) green (c) black (d) red
  5. 5.⚖️ What colour is the text of this element?
    <h1 class="star" id="intro">Hi</h1>
    CSS:
    .star { color: yellow; }
    .star { color: orange; }
    (a) orange (b) black (c) purple (d) yellow
  6. 6.True or false: #main is an element selector. (a) False (b) True
  7. 7.📱 What does a media query check? (a) the time of day (b) the screen width (c) the battery level (d) the page title
  8. 8.🌈 Which hex code is red? (a) #ffff00 (b) #ff00ff (c) #000000 (d) #ff0000
  9. 9.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) neither (c) the later one (d) the first one
  10. 10.What does text-align do? (a) picks the font style (b) sets the letter colour (c) colours behind the text (d) centres a heading
  11. 11.🖌️ Which CSS property picks the font style? (a) font-size (b) font-family (c) font-weight (d) color
  12. 12.🖌️ How big is the text, in px?
    h1 {
      color: blue;
      text-align: right;
      background-color: black;
      font-size: 40px;
    }
  13. 13.🧩 Which language changes the page live? (a) HTML (b) CSS (c) JavaScript
  14. 14.💪 Which flexbox property picks row or column? (a) align-items (b) flex-direction (c) display: flex (d) justify-content
  15. 15.True or false: CSS counts down a timer. (a) False (b) True
  16. 16.✍️ What is the selector in this CSS rule?
    p {
      font-size: 20px;
      font-weight: bold;
      margin: 10px;
    }
    (a) .note (b) p (c) font-size (d) bold
  17. 17.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 220px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  18. 18.True or false: HTML puts a picture on a page. (a) False (b) True
  19. 19.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 160px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  20. 20.⚖️ Which selector is the strongest? (a) an id selector (b) an element selector (c) a class selector
  21. 21.📱 The screen is 820px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 20px;
      }
    }
    (a) Yes (b) No
  22. 22.💪 Which justify-content value packs boxes at the start? (a) flex-start (b) space-between (c) center (d) flex-end
  23. 23.⚖️ What colour is the text of this element?
    <p class="star" id="main">Hi</p>
    CSS:
    p { color: blue; }
    p { color: purple; }
    (a) red (b) blue (c) yellow (d) purple
  24. 24.⚖️ What colour is the text of this element?
    <p class="big" id="main">Hi</p>
    CSS:
    #main { color: orange; }
    p { color: white; }
    (a) white (b) orange (c) green (d) red
  25. 25.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 180px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 40px wide (no margins).
  26. 26.🎯 Which CSS selector matches this element?
    <p class="menu" id="top">Hello</p>
    (a) p (b) .top (c) #menu (d) .note
  27. 27.🎯 What kind of selector is img? (a) an id selector (b) an element selector (c) a class selector
  28. 28.🌈 Which colour is #00ffff? (a) red (b) cyan (c) black (d) magenta
  29. 29.🎨 One CSS file can style how many pages? (a) no pages (b) only one image (c) many pages (d) only one word
  30. 30.⚖️ What colour is the text of this element?
    <h1 class="red" id="main">Hi</h1>
    CSS:
    h1 { color: orange; }
    .red { color: red; }
    (a) orange (b) blue (c) black (d) red
  31. 31.⚖️ What colour is the text of this element?
    <p class="big" id="top">Hi</p>
    CSS:
    #top { color: black; }
    .big { color: purple; }
    (a) black (b) purple (c) green (d) yellow
  32. 32.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 8px;
      }
    }
    (a) No (b) Yes
  33. 33.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 24px;
      }
    }
  34. 34.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 30px;
      }
    }
    (a) Yes (b) No
  35. 35.🎯 Which element does the selector #end style? (a) <span class="end"> (b) <span id="hero"> (c) <span id="end"> (d) <p class="menu">
  36. 36.Which of these is padding? (a) space outside the border (b) the gap to other boxes (c) the gap round content (d) the text or picture
  37. 37.✍️ CSS declarations go inside which brackets? (a) { } (b) < > (c) [ ] (d) ( )
  38. 38.🎯 What kind of selector is .note? (a) a class selector (b) an element selector (c) an id selector
  39. 39.⚖️ What colour is the text of this element?
    <h1 class="menu" id="intro">Hi</h1>
    CSS:
    .menu { color: orange; }
    .menu { color: red; }
    (a) black (b) blue (c) orange (d) red
  40. 40.🌈 In #00dd00 the green part is the hex number dd. What is it as a normal number?

Answer key

  1. purple
  2. 22
  3. #
  4. red
  5. orange
  6. False
  7. the screen width
  8. #ff0000
  9. the later one
  10. centres a heading
  11. font-family
  12. 40
  13. JavaScript
  14. flex-direction
  15. False
  16. p
  17. 20
  18. True
  19. 40
  20. an id selector
  21. Yes
  22. flex-start
  23. purple
  24. orange
  25. 60
  26. p
  27. an element selector
  28. cyan
  29. many pages
  30. red
  31. black
  32. No
  33. 16
  34. No
  35. <span id="end">
  36. the gap round content
  37. { }
  38. a class selector
  39. red
  40. 221

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