← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 578 · 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 selector is the weakest? (a) an id selector (b) an element selector (c) a class selector
  2. 2.⚖️ What colour is the text of this element?
    <p class="star" id="hero">Hi</p>
    CSS:
    p { color: red; }
    p { color: green; }
    (a) red (b) green (c) white (d) blue
  3. 3.✍️ What value is given to font-weight in this rule?
    .note {
      font-weight: bold;
      background-color: yellow;
    }
    (a) 2px solid (b) bold (c) font-weight (d) 300px
  4. 4.✍️ What is the selector in this CSS rule?
    #top {
      width: 300px;
      font-style: italic;
    }
    (a) #top (b) italic (c) li (d) width
  5. 5.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 180px;
      padding: 25px;
      border: 2px solid black;
      margin: 20px;
    }
  6. 6.✍️ How does a CSS comment start? (a) // (b) # (c) /* (d) <!--
  7. 7.🎯 Which element does the selector .box style? (a) <p class="menu"> (b) <span id="box"> (c) <span class="star"> (d) <span class="box">
  8. 8.✍️ Which sign goes between a property and its value? (a) ; (b) - (c) = (d) :
  9. 9.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 140px;
      padding: 15px;
      border: 2px solid black;
      margin: 10px;
    }
  10. 10.🔍 Which is the odd one out? (a) makes a form box (b) changes the text size (c) puts a picture on a page (d) makes a link
  11. 11.True or false: JavaScript gives the page structure. (a) False (b) True
  12. 12.📱 What does a media query check? (a) the page title (b) the time of day (c) the screen width (d) the battery level
  13. 13.🖌️ Which CSS property picks the font style? (a) font-size (b) text-align (c) font-family (d) color
  14. 14.📱 The screen is 1366px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 24px;
      }
    }
    (a) No (b) Yes
  15. 15.⚖️ What colour is the text of this element?
    <h2 class="box" id="end">Hi</h2>
    CSS:
    h2 { color: yellow; }
    #end { color: orange; }
    (a) black (b) green (c) yellow (d) orange
  16. 16.✍️ What is the selector in this CSS rule?
    .note {
      background-color: yellow;
      font-weight: bold;
      color: red;
    }
    (a) bold (b) .note (c) #top (d) background-color
  17. 17.True or false: CSS changes the text size. (a) False (b) True
  18. 18.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 24px;
      }
    }
  19. 19.🌈 In #rrggbb, which colour do the last two digits give? (a) blue (b) white (c) red (d) green
  20. 20.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 16px;
      }
    }
  21. 21.✍️ What is the selector in this CSS rule?
    li {
      text-align: center;
      padding: 8px;
      font-size: 20px;
    }
    (a) 8px (b) body (c) text-align (d) li
  22. 22.True or false: JavaScript makes a form box. (a) False (b) True
  23. 23.🖌️ Which CSS property makes the text bold? (a) text-align (b) font-weight (c) color (d) font-size
  24. 24.⚖️ What colour is the text of this element?
    <h1 class="red" id="main">Hi</h1>
    CSS:
    #main { color: black; }
    .red { color: blue; }
    (a) blue (b) purple (c) green (d) black
  25. 25.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 22px;
      }
    }
  26. 26.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 230px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  27. 27.🌈 Which colour is #ffffff? (a) bright green (b) white (c) black (d) red
  28. 28.💪 Which flexbox property lines boxes up across? (a) gap (b) display: flex (c) align-items (d) flex-direction
  29. 29.🌈 Which colour is #0000ff? (a) bright green (b) blue (c) cyan (d) yellow
  30. 30.💪 Which flexbox property picks row or column? (a) justify-content (b) flex-direction (c) align-items (d) display: flex
  31. 31.🎯 What kind of selector is #logo? (a) an element selector (b) an id selector (c) a class selector
  32. 32.💪 Which flexbox property sets space between boxes? (a) display: flex (b) align-items (c) flex-direction (d) gap
  33. 33.✍️ In color: blue; which part is the value? (a) : (b) ; (c) blue (d) color
  34. 34.True or false: CSS sets colours and fonts. (a) False (b) True
  35. 35.🖌️ What colour is behind the letters?
    li {
      color: red;
      font-size: 24px;
      text-align: right;
      background-color: white;
    }
    (a) white (b) blue (c) red
  36. 36.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 100px;
      padding: 20px;
      border: 4px solid black;
      margin: 15px;
    }
  37. 37.🌈 In #2f0000 the red part is the hex number 2f. What is it as a normal number?
  38. 38.🔍 Which is the odd one out? (a) gives the page structure (b) puts a picture on a page (c) makes headings and lists (d) changes the page live
  39. 39.🧩 Which language makes a link? (a) CSS (b) HTML (c) JavaScript
  40. 40.📦 In the box model, which part is the text or picture? (a) padding (b) content (c) border (d) margin

Answer key

  1. an element selector
  2. green
  3. bold
  4. #top
  5. 274
  6. /*
  7. <span class="box">
  8. :
  9. 194
  10. changes the text size
  11. False
  12. the screen width
  13. font-family
  14. Yes
  15. orange
  16. .note
  17. True
  18. 24
  19. blue
  20. 12
  21. li
  22. False
  23. font-weight
  24. black
  25. 24
  26. 30
  27. white
  28. align-items
  29. blue
  30. flex-direction
  31. an id selector
  32. gap
  33. blue
  34. True
  35. white
  36. 178
  37. 47
  38. changes the page live
  39. HTML
  40. content

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