← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 665 · 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.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 270px;
      padding: 25px;
      border: 4px solid black;
      margin: 20px;
    }
  2. 2.🎯 What kind of selector is .card? (a) an element selector (b) a class selector (c) an id selector
  3. 3.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 18px;
      }
    }
    (a) Yes (b) No
  4. 4.🌈 Which colour is rgb(0, 0, 255)? (a) white (b) red (c) blue (d) yellow
  5. 5.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 260px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  6. 6.🖌️ Which CSS property makes the text bold? (a) color (b) background-color (c) font-weight (d) font-size
  7. 7.✍️ What is the selector in this CSS rule?
    h1 {
      padding: 8px;
      font-size: 20px;
      margin: 10px;
    }
    (a) padding (b) p (c) 20px (d) h1
  8. 8.Which of these does HTML do? (a) changes the text size (b) counts down a timer (c) makes a link (d) adds space around boxes
  9. 9.True or false: li is an element selector. (a) True (b) False
  10. 10.📱 Which tag helps phones show a page at the right size? (a) the br tag (b) the title tag (c) the hr tag (d) the viewport meta tag
  11. 11.🎨 Which tag connects an outside CSS file? (a) <a> (b) <css> (c) <img> (d) <link>
  12. 12.📦 In the box model, which part is the gap to other boxes? (a) margin (b) content (c) padding (d) border
  13. 13.✍️ Which sign ends each CSS declaration? (a) , (b) : (c) . (d) ;
  14. 14.💪 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).
  15. 15.⚖️ What colour is the text of this element?
    <h2 class="big" id="top">Hi</h2>
    CSS:
    h2 { color: yellow; }
    h2 { color: red; }
    (a) yellow (b) red (c) blue (d) white
  16. 16.🌈 In #rrggbb, which colour do the first two digits give? (a) green (b) black (c) blue (d) red
  17. 17.⚖️ What colour is the text of this element?
    <h2 class="box" id="top">Hi</h2>
    CSS:
    h2 { color: red; }
    h2 { color: orange; }
    (a) purple (b) white (c) orange (d) red
  18. 18.✍️ Which property is set to 300px in this rule?
    .box {
      border: 2px solid;
      width: 300px;
      text-align: center;
    }
    (a) width (b) color (c) font-style (d) 300px
  19. 19.🎯 Which CSS selector matches this element?
    <h2 class="red" id="logo">Hello</h2>
    (a) #red (b) .logo (c) h2 (d) #end
  20. 20.🖌️ What colour are the letters?
    h1 {
      font-size: 24px;
      text-align: right;
      color: white;
      background-color: orange;
    }
    (a) orange (b) red (c) white
  21. 21.🖌️ How big is the text, in px?
    p {
      background-color: orange;
      text-align: center;
      font-size: 36px;
      color: purple;
    }
  22. 22.💪 Which justify-content value equal gaps, none at ends? (a) flex-start (b) center (c) flex-end (d) space-between
  23. 23.🖌️ Which CSS property picks the font style? (a) text-align (b) font-size (c) color (d) font-family
  24. 24.⚖️ What colour is the text of this element?
    <p class="star" id="logo">Hi</p>
    CSS:
    .star { color: blue; }
    #logo { color: red; }
    p { color: yellow; }
    (a) yellow (b) green (c) red (d) blue
  25. 25.Which of these does HTML do? (a) adds space around boxes (b) checks a quiz answer (c) counts down a timer (d) puts a picture on a page
  26. 26.🧩 Which language sets colours and fonts? (a) JavaScript (b) HTML (c) CSS
  27. 27.🎯 How many elements on a page should have the same id? (a) 5 (b) 1 (c) any number (d) 2
  28. 28.🖌️ Which CSS property centres a heading? (a) background-color (b) font-family (c) text-align (d) color
  29. 29.🧩 Which language puts a picture on a page? (a) CSS (b) JavaScript (c) HTML
  30. 30.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 350px;
      justify-content: flex-end;
    }
    Inside are 3 boxes, each 100px wide (no margins).
  31. 31.🧩 Which language makes headings and lists? (a) JavaScript (b) HTML (c) CSS
  32. 32.🎨 What does CSS stand for? (a) Computer Style Sheets (b) Cascading Style Sheets (c) Colourful Site Styles (d) Creative Sheet System
  33. 33.🧩 Which language gives the page structure? (a) CSS (b) JavaScript (c) HTML
  34. 34.🖌️ Which CSS property sets the letter colour? (a) font-family (b) background-color (c) font-size (d) color
  35. 35.🖌️ What colour are the letters?
    li {
      font-size: 16px;
      text-align: right;
      background-color: green;
      color: red;
    }
    (a) green (b) black (c) red
  36. 36.🖌️ What colour is behind the letters?
    li {
      color: black;
      background-color: purple;
      text-align: center;
      font-size: 12px;
    }
    (a) black (b) blue (c) purple
  37. 37.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 50px;
      padding: 5px;
      border: 2px solid black;
      margin: 0px;
    }
  38. 38.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 14px;
      }
    }
    (a) No (b) Yes
  39. 39.⚖️ Which selector is the strongest? (a) an id selector (b) a class selector (c) an element selector
  40. 40.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 200px;
      justify-content: flex-end;
    }
    Inside are 3 boxes, each 50px wide (no margins).

Answer key

  1. 368
  2. a class selector
  3. No
  4. blue
  5. 60
  6. font-weight
  7. h1
  8. makes a link
  9. True
  10. the viewport meta tag
  11. <link>
  12. margin
  13. ;
  14. 30
  15. red
  16. red
  17. orange
  18. width
  19. h2
  20. white
  21. 36
  22. space-between
  23. font-family
  24. red
  25. puts a picture on a page
  26. CSS
  27. 1
  28. text-align
  29. HTML
  30. 50
  31. HTML
  32. Cascading Style Sheets
  33. HTML
  34. color
  35. red
  36. purple
  37. 64
  38. Yes
  39. an id selector
  40. 50

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