← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 382 · 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.⚖️ Two rules with the same selector set a colour. Which one wins? (a) neither (b) the first one (c) the later one (d) the shorter one
  2. 2.🌈 Which colour is #ff0000? (a) cyan (b) red (c) black (d) magenta
  3. 3.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 230px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 80px wide (no margins).
  4. 4.⚖️ What colour is the text of this element?
    <h2 class="big" id="end">Hi</h2>
    CSS:
    #end { color: green; }
    .big { color: blue; }
    (a) purple (b) black (c) green (d) blue
  5. 5.💪 Which flexbox property spaces boxes along a row? (a) gap (b) justify-content (c) align-items (d) display: flex
  6. 6.True or false: padding is the gap to other boxes. (a) True (b) False
  7. 7.🌈 Hex digits go 0 to 9, then A to which letter? (a) J (b) G (c) Z (d) F
  8. 8.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 130px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  9. 9.📦 In the box model, which part is the text or picture? (a) border (b) padding (c) content (d) margin
  10. 10.🎨 Which tag holds CSS inside the head? (a) <body> (b) <style> (c) <css> (d) <script>
  11. 11.🌈 In #000010 the blue part is the hex number 10. What is it as a normal number?
  12. 12.🖌️ Where does the text sit on its line?
    li {
      background-color: black;
      color: red;
      font-size: 28px;
      text-align: right;
    }
    (a) in the middle (b) on the left (c) on the right
  13. 13.⚖️ What colour is the text of this element?
    <p class="star" id="main">Hi</p>
    CSS:
    #main { color: blue; }
    .star { color: yellow; }
    p { color: black; }
    (a) yellow (b) blue (c) green (d) black
  14. 14.✍️ In color: blue; which part is the value? (a) color (b) ; (c) : (d) blue
  15. 15.⚖️ What colour is the text of this element?
    <h2 class="menu" id="intro">Hi</h2>
    CSS:
    #intro { color: green; }
    #intro { color: yellow; }
    (a) black (b) green (c) yellow (d) orange
  16. 16.🌈 Which colour is rgb(0, 0, 255)? (a) blue (b) white (c) red (d) yellow
  17. 17.⚖️ Which selector is the strongest? (a) an id selector (b) a class selector (c) an element selector
  18. 18.💪 Which justify-content value packs boxes at the start? (a) space-between (b) center (c) flex-end (d) flex-start
  19. 19.🖌️ Which CSS property makes letters bigger? (a) font-size (b) background-color (c) font-family (d) text-align
  20. 20.✍️ How does a CSS comment start? (a) /* (b) <!-- (c) # (d) //
  21. 21.🖌️ How big is the text, in px?
    li {
      color: purple;
      text-align: right;
      background-color: white;
      font-size: 20px;
    }
  22. 22.✍️ What value is given to font-weight in this rule?
    .box {
      font-weight: bold;
      border: 2px solid;
      padding: 8px;
      background-color: yellow;
    }
    (a) font-weight (b) 2px solid (c) 300px (d) bold
  23. 23.💪 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 60px wide (no margins).
  24. 24.True or false: JavaScript shows a pop-up message. (a) True (b) False
  25. 25.What does justify-content: flex-end do? (a) packs boxes at the start (b) puts boxes in the middle (c) packs boxes at the end (d) equal gaps, none at ends
  26. 26.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 24px;
      }
    }
  27. 27.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 120px;
      padding: 15px;
      border: 2px solid black;
      margin: 5px;
    }
  28. 28.Which of these is the content? (a) a solid or dotted edge (b) the gap round content (c) space outside the border (d) the text or picture
  29. 29.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      color: red;
      background-color: yellow;
      border: 2px solid;
    }
  30. 30.🌈 In #00f400 the green part is the hex number f4. What is it as a normal number?
  31. 31.🖌️ Where does the text sit on its line?
    h1 {
      background-color: white;
      text-align: center;
      color: green;
      font-size: 16px;
    }
    (a) on the left (b) in the middle (c) on the right
  32. 32.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 400px;
      justify-content: center;
    }
    Inside are 3 boxes, each 80px wide (no margins).
  33. 33.📦 In the box model, which part is the gap round content? (a) content (b) margin (c) padding (d) border
  34. 34.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 340px;
      justify-content: center;
    }
    Inside are 3 boxes, each 80px wide (no margins).
  35. 35.Which of these does HTML do? (a) changes the page live (b) shows a pop-up message (c) reacts to a button click (d) makes a link
  36. 36.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 150px;
      padding: 25px;
      border: 5px solid black;
      margin: 20px;
    }
  37. 37.True or false: CSS makes a link. (a) False (b) True
  38. 38.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      width: 300px;
      text-align: center;
    }
  39. 39.🔍 Which is the odd one out? (a) makes a link (b) rounds box corners (c) makes headings and lists (d) gives the page structure
  40. 40.True or false: JavaScript checks a quiz answer. (a) True (b) False

Answer key

  1. the later one
  2. red
  3. 70
  4. green
  5. justify-content
  6. False
  7. F
  8. 10
  9. content
  10. <style>
  11. 16
  12. on the right
  13. blue
  14. blue
  15. yellow
  16. blue
  17. an id selector
  18. flex-start
  19. font-size
  20. /*
  21. 20
  22. bold
  23. 20
  24. True
  25. packs boxes at the end
  26. 16
  27. 164
  28. the text or picture
  29. 3
  30. 244
  31. in the middle
  32. 80
  33. padding
  34. 50
  35. makes a link
  36. 250
  37. False
  38. 2
  39. rounds box corners
  40. True

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