← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 188 · 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 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 10px;
      }
    }
  2. 2.Which of these does JavaScript do? (a) changes the page live (b) makes a form box (c) makes headings and lists (d) puts a picture on a page
  3. 3.💪 Which flexbox property turns on flexbox? (a) justify-content (b) display: flex (c) align-items (d) flex-direction
  4. 4.📦 In the box model, which part is the text or picture? (a) border (b) padding (c) margin (d) content
  5. 5.✍️ CSS declarations go inside which brackets? (a) < > (b) ( ) (c) [ ] (d) { }
  6. 6.Which of these is the content? (a) space outside the border (b) the text or picture (c) a solid or dotted edge (d) the gap to other boxes
  7. 7.📦 In the box model, which part is the gap to other boxes? (a) border (b) margin (c) padding (d) content
  8. 8.True or false: the content is space inside the border. (a) False (b) True
  9. 9.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 70px;
      padding: 25px;
      border: 3px solid black;
      margin: 5px;
    }
  10. 10.✍️ How does a CSS comment start? (a) <!-- (b) // (c) /* (d) #
  11. 11.💪 Which flexbox property spaces boxes along a row? (a) flex-direction (b) justify-content (c) align-items (d) display: flex
  12. 12.True or false: CSS changes the text size. (a) True (b) False
  13. 13.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      color: red;
      font-size: 20px;
      width: 300px;
    }
  14. 14.🎨 What does CSS stand for? (a) Creative Sheet System (b) Colourful Site Styles (c) Cascading Style Sheets (d) Computer Style Sheets
  15. 15.📱 max-width: 600px applies when the screen is ___. (a) 600px or narrower (b) turned off (c) exactly 1000px (d) 600px or wider
  16. 16.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 18px;
      }
    }
  17. 17.True or false: HTML makes headings and lists. (a) True (b) False
  18. 18.✍️ What is the selector in this CSS rule?
    #top {
      color: red;
      margin: 10px;
    }
    (a) #top (b) color (c) li (d) 10px
  19. 19.🖌️ How big is the text, in px?
    h2 {
      background-color: yellow;
      color: blue;
      text-align: left;
      font-size: 28px;
    }
  20. 20.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 32px;
      }
    }
  21. 21.🎨 Which tag holds CSS inside the head? (a) <script> (b) <body> (c) <css> (d) <style>
  22. 22.🌈 Which colour is #ffffff? (a) red (b) yellow (c) white (d) cyan
  23. 23.🌈 Which hex code is bright green? (a) #ff00ff (b) #0000ff (c) #00ff00 (d) #000000
  24. 24.⚖️ What colour is the text of this element?
    <p class="menu" id="main">Hi</p>
    CSS:
    p { color: green; }
    p { color: purple; }
    (a) green (b) red (c) orange (d) purple
  25. 25.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 150px;
      padding: 20px;
      border: 3px solid black;
      margin: 15px;
    }
  26. 26.✍️ How many declarations (property: value pairs) are in this rule?
    #top {
      padding: 8px;
      width: 300px;
      background-color: yellow;
      color: red;
    }
  27. 27.🖌️ What colour is behind the letters?
    h1 {
      text-align: right;
      background-color: black;
      color: red;
      font-size: 20px;
    }
    (a) red (b) black (c) orange
  28. 28.📱 Responsive design means a page ___. (a) has no pictures (b) is only for laptops (c) never changes (d) fits every screen
  29. 29.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 310px;
      justify-content: center;
    }
    Inside are 3 boxes, each 50px wide (no margins).
  30. 30.🎯 What kind of selector is .star? (a) an id selector (b) a class selector (c) an element selector
  31. 31.🧩 Which language sets colours and fonts? (a) JavaScript (b) HTML (c) CSS
  32. 32.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 20px;
      }
    }
    (a) No (b) Yes
  33. 33.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 260px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  34. 34.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      border: 2px solid;
    }
  35. 35.🎯 Which element does the selector p style? (a) <p class="big"> (b) <h1> (c) <h2 class="big"> (d) <li id="hero">
  36. 36.🧩 Which language makes headings and lists? (a) HTML (b) CSS (c) JavaScript
  37. 37.🔍 Which is the odd one out? (a) makes a form box (b) rounds box corners (c) makes headings and lists (d) makes a link
  38. 38.⚖️ Which selector is the strongest? (a) a class selector (b) an element selector (c) an id selector
  39. 39.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      background-color: yellow;
    }
  40. 40.🖌️ Where does the text sit on its line?
    h2 {
      text-align: left;
      background-color: yellow;
      font-size: 12px;
      color: green;
    }
    (a) in the middle (b) on the left (c) on the right

Answer key

  1. 10
  2. changes the page live
  3. display: flex
  4. content
  5. { }
  6. the text or picture
  7. margin
  8. False
  9. 136
  10. /*
  11. justify-content
  12. True
  13. 3
  14. Cascading Style Sheets
  15. 600px or narrower
  16. 18
  17. True
  18. #top
  19. 28
  20. 24
  21. <style>
  22. white
  23. #00ff00
  24. purple
  25. 196
  26. 4
  27. black
  28. fits every screen
  29. 80
  30. a class selector
  31. CSS
  32. No
  33. 60
  34. 1
  35. <p class="big">
  36. HTML
  37. rounds box corners
  38. an id selector
  39. 1
  40. on the left

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