← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 508 · 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="big" id="intro">Hi</p>
    CSS:
    #intro { color: blue; }
    #intro { color: red; }
    (a) green (b) blue (c) red (d) black
  2. 2.Which of these does JavaScript do? (a) makes a link (b) gives the page structure (c) changes the page live (d) lays out the page
  3. 3.💪 Which justify-content value puts boxes in the middle? (a) flex-end (b) space-between (c) flex-start (d) center
  4. 4.🧩 Which language lays out the page? (a) HTML (b) CSS (c) JavaScript
  5. 5.🌈 In #890000 the red part is the hex number 89. What is it as a normal number?
  6. 6.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 160px;
      justify-content: center;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  7. 7.📱 Responsive design means a page ___. (a) is only for laptops (b) has no pictures (c) never changes (d) fits every screen
  8. 8.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 18px;
      }
    }
  9. 9.📱 max-width: 600px applies when the screen is ___. (a) 600px or wider (b) 600px or narrower (c) turned off (d) exactly 1000px
  10. 10.🖌️ Which CSS property picks the font style? (a) color (b) font-family (c) text-align (d) background-color
  11. 11.🎯 Which CSS selector matches this element?
    <h1 class="menu" id="intro">Hello</h1>
    (a) h2 (b) h1 (c) #main (d) .note
  12. 12.🖌️ Which CSS property centres a heading? (a) font-size (b) font-weight (c) background-color (d) text-align
  13. 13.🖌️ How big is the text, in px?
    li {
      color: red;
      background-color: yellow;
      font-size: 28px;
      text-align: right;
    }
  14. 14.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      font-weight: bold;
      width: 300px;
      background-color: yellow;
    }
  15. 15.✍️ CSS declarations go inside which brackets? (a) ( ) (b) { } (c) [ ] (d) < >
  16. 16.🧩 Which language sets colours and fonts? (a) HTML (b) JavaScript (c) CSS
  17. 17.🎯 Which element does the selector h1 style? (a) <div id="top"> (b) <li class="note"> (c) <h1 class="note"> (d) <h2>
  18. 18.Which of these is margin? (a) the gap to other boxes (b) space inside the border (c) a solid or dotted edge (d) the gap round content
  19. 19.📦 In the box model, which part is the text or picture? (a) margin (b) padding (c) content (d) border
  20. 20.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      border: 2px solid;
      margin: 10px;
    }
  21. 21.🎯 Which CSS selector matches this element?
    <h2 class="star" id="top">Hello</h2>
    (a) .menu (b) #star (c) .top (d) #top
  22. 22.🌈 In #002e00 the green part is the hex number 2e. What is it as a normal number?
  23. 23.✍️ What is the selector in this CSS rule?
    body {
      background-color: yellow;
      border: 2px solid;
      padding: 8px;
    }
    (a) body (b) 2px solid (c) background-color (d) .box
  24. 24.What does font-size do? (a) makes the text bold (b) sets the letter colour (c) picks the font style (d) makes letters bigger
  25. 25.🔍 Which is the odd one out? (a) puts a picture on a page (b) changes the text size (c) makes a form box (d) makes a link
  26. 26.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      margin: 10px;
      border: 2px solid;
      color: red;
    }
  27. 27.📱 What does a media query check? (a) the page title (b) the time of day (c) the screen width (d) the battery level
  28. 28.True or false: margin is space outside the border. (a) False (b) True
  29. 29.⚖️ What colour is the text of this element?
    <h2 class="box" id="hero">Hi</h2>
    CSS:
    #hero { color: white; }
    #hero { color: orange; }
    (a) white (b) yellow (c) orange (d) black
  30. 30.🖌️ Which CSS property colours behind the text? (a) background-color (b) font-family (c) text-align (d) color
  31. 31.🌈 Hex digits go 0 to 9, then A to which letter? (a) J (b) G (c) F (d) Z
  32. 32.🖌️ What colour are the letters?
    p {
      color: black;
      font-size: 12px;
      text-align: center;
      background-color: white;
    }
    (a) white (b) red (c) black
  33. 33.🌈 Which colour is rgb(255, 0, 0)? (a) black (b) red (c) magenta (d) blue
  34. 34.⚖️ What colour is the text of this element?
    <h1 class="note" id="intro">Hi</h1>
    CSS:
    .note { color: white; }
    .note { color: red; }
    (a) yellow (b) purple (c) red (d) white
  35. 35.True or false: .big is an id selector. (a) False (b) True
  36. 36.🔍 Which is the odd one out? (a) makes a form box (b) adds space around boxes (c) changes the text size (d) lays out the page
  37. 37.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 160px;
      justify-content: flex-end;
    }
    Inside are 3 boxes, each 40px wide (no margins).
  38. 38.🎯 Can many elements share the same class? (a) No (b) Yes
  39. 39.🖌️ How big is the text, in px?
    li {
      text-align: left;
      font-size: 20px;
      color: white;
      background-color: purple;
    }
  40. 40.🖌️ What colour is behind the letters?
    h1 {
      font-size: 40px;
      color: green;
      text-align: right;
      background-color: purple;
    }
    (a) green (b) yellow (c) purple

Answer key

  1. red
  2. changes the page live
  3. center
  4. CSS
  5. 137
  6. 20
  7. fits every screen
  8. 18
  9. 600px or narrower
  10. font-family
  11. h1
  12. text-align
  13. 28
  14. 3
  15. { }
  16. CSS
  17. <h1 class="note">
  18. the gap to other boxes
  19. content
  20. 2
  21. #top
  22. 46
  23. body
  24. makes letters bigger
  25. changes the text size
  26. 3
  27. the screen width
  28. True
  29. orange
  30. background-color
  31. F
  32. black
  33. red
  34. red
  35. False
  36. makes a form box
  37. 40
  38. Yes
  39. 20
  40. purple

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