← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 968 · 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.Which of these does HTML do? (a) sets colours and fonts (b) checks a quiz answer (c) changes the page live (d) makes a form box
  2. 2.⚖️ What colour is the text of this element?
    <p class="big" id="hero">Hi</p>
    CSS:
    p { color: orange; }
    .big { color: blue; }
    (a) blue (b) orange (c) white (d) green
  3. 3.⚖️ What colour is the text of this element?
    <p class="box" id="hero">Hi</p>
    CSS:
    p { color: red; }
    #hero { color: green; }
    .box { color: white; }
    (a) red (b) yellow (c) green (d) white
  4. 4.📦 In the box model, which part is space outside the border? (a) padding (b) content (c) margin (d) border
  5. 5.True or false: HTML checks a quiz answer. (a) False (b) True
  6. 6.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 330px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 60px wide (no margins).
  7. 7.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 200px;
      padding: 30px;
      border: 4px solid black;
      margin: 5px;
    }
  8. 8.✍️ What value is given to margin in this rule?
    p {
      border: 2px solid;
      margin: 10px;
      font-style: italic;
      width: 300px;
    }
    (a) 8px (b) margin (c) 10px (d) bold
  9. 9.🖌️ How big is the text, in px?
    h1 {
      font-size: 40px;
      background-color: white;
      text-align: left;
      color: yellow;
    }
  10. 10.✍️ In color: blue; which part is the value? (a) ; (b) : (c) blue (d) color
  11. 11.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 180px;
      padding: 15px;
      border: 1px solid black;
      margin: 10px;
    }
  12. 12.⚖️ Which selector is the strongest? (a) a class selector (b) an id selector (c) an element selector
  13. 13.⚖️ What colour is the text of this element?
    <h1 class="red" id="hero">Hi</h1>
    CSS:
    #hero { color: yellow; }
    #hero { color: orange; }
    (a) orange (b) green (c) purple (d) yellow
  14. 14.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 270px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 80px wide (no margins).
  15. 15.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 18px;
      }
    }
  16. 16.What does color do? (a) colours behind the text (b) makes the text bold (c) sets the letter colour (d) picks the font style
  17. 17.Which of these does CSS do? (a) makes a form box (b) adds space around boxes (c) gives the page structure (d) shows a pop-up message
  18. 18.✍️ CSS declarations go inside which brackets? (a) < > (b) [ ] (c) { } (d) ( )
  19. 19.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 100px;
      padding: 5px;
      border: 3px solid black;
      margin: 10px;
    }
  20. 20.✍️ How does a CSS comment start? (a) # (b) /* (c) <!-- (d) //
  21. 21.💪 Which flexbox property sets space between boxes? (a) flex-direction (b) display: flex (c) justify-content (d) gap
  22. 22.🧩 Which language lays out the page? (a) HTML (b) CSS (c) JavaScript
  23. 23.✍️ What value is given to background-color in this rule?
    #top {
      border: 2px solid;
      background-color: yellow;
      margin: 10px;
      color: red;
    }
    (a) 10px (b) yellow (c) background-color (d) 8px
  24. 24.✍️ Which sign ends each CSS declaration? (a) . (b) , (c) : (d) ;
  25. 25.True or false: h1 is an element selector. (a) False (b) True
  26. 26.⚖️ What colour is the text of this element?
    <h1 class="red" id="intro">Hi</h1>
    CSS:
    #intro { color: yellow; }
    #intro { color: blue; }
    (a) yellow (b) purple (c) blue (d) white
  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.🖌️ How big is the text, in px?
    li {
      font-size: 36px;
      color: yellow;
      background-color: red;
      text-align: right;
    }
  29. 29.📱 Which tag helps phones show a page at the right size? (a) the viewport meta tag (b) the hr tag (c) the title tag (d) the br tag
  30. 30.📦 In the box model, which part is the text or picture? (a) margin (b) border (c) padding (d) content
  31. 31.🎯 What kind of selector is p? (a) an id selector (b) a class selector (c) an element selector
  32. 32.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 200px;
      padding: 20px;
      border: 3px solid black;
      margin: 15px;
    }
  33. 33.✍️ Which property is set to 8px in this rule?
    body {
      padding: 8px;
      width: 300px;
      font-style: italic;
      margin: 10px;
    }
    (a) border (b) font-weight (c) padding (d) 8px
  34. 34.✍️ Which property is set to 2px solid in this rule?
    h2 {
      width: 300px;
      font-weight: bold;
      border: 2px solid;
    }
    (a) border (b) 2px solid (c) width (d) font-style
  35. 35.What does background-color do? (a) sets the letter colour (b) makes letters bigger (c) colours behind the text (d) picks the font style
  36. 36.🌈 Which colour is #00ff00? (a) red (b) white (c) yellow (d) bright green
  37. 37.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 80px;
      padding: 5px;
      border: 2px solid black;
      margin: 15px;
    }
  38. 38.True or false: padding is the gap round content. (a) True (b) False
  39. 39.🖌️ How big is the text, in px?
    h1 {
      text-align: right;
      font-size: 20px;
      color: orange;
      background-color: blue;
    }
  40. 40.🧩 Which language changes the text size? (a) CSS (b) HTML (c) JavaScript

Answer key

  1. makes a form box
  2. blue
  3. green
  4. margin
  5. False
  6. 30
  7. 278
  8. 10px
  9. 40
  10. blue
  11. 212
  12. an id selector
  13. orange
  14. 30
  15. 18
  16. sets the letter colour
  17. adds space around boxes
  18. { }
  19. 136
  20. /*
  21. gap
  22. CSS
  23. yellow
  24. ;
  25. True
  26. blue
  27. the screen width
  28. 36
  29. the viewport meta tag
  30. content
  31. an element selector
  32. 246
  33. padding
  34. border
  35. colours behind the text
  36. bright green
  37. 124
  38. True
  39. 20
  40. CSS

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