← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 345 · 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 sign goes between a property and its value? (a) - (b) ; (c) : (d) =
  2. 2.📦 In the box model, which part is the line round the box? (a) padding (b) border (c) margin (d) content
  3. 3.What does font-size do? (a) picks the font style (b) makes the text bold (c) makes letters bigger (d) centres a heading
  4. 4.✍️ What value is given to font-weight in this rule?
    .box {
      font-weight: bold;
      border: 2px solid;
      padding: 8px;
      margin: 10px;
    }
    (a) font-weight (b) bold (c) 300px (d) 2px solid
  5. 5.🧩 Which language sets colours and fonts? (a) JavaScript (b) HTML (c) CSS
  6. 6.📦 In the box model, which part is a solid or dotted edge? (a) margin (b) padding (c) border (d) content
  7. 7.🌈 Which colour is rgb(255, 255, 255)? (a) white (b) yellow (c) blue (d) red
  8. 8.Which of these does JavaScript do? (a) reacts to a button click (b) makes a form box (c) makes headings and lists (d) lays out the page
  9. 9.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 50px;
      padding: 25px;
      border: 3px solid black;
      margin: 10px;
    }
  10. 10.🌈 Which hex code is blue? (a) #00ffff (b) #0000ff (c) #ffff00 (d) #ffffff
  11. 11.⚖️ What colour is the text of this element?
    <p class="menu" id="logo">Hi</p>
    CSS:
    p { color: red; }
    p { color: purple; }
    (a) purple (b) white (c) red (d) yellow
  12. 12.💪 Which justify-content value puts boxes in the middle? (a) flex-start (b) flex-end (c) space-between (d) center
  13. 13.💪 Which flexbox property turns on flexbox? (a) justify-content (b) gap (c) align-items (d) display: flex
  14. 14.🖌️ Which CSS property sets the letter colour? (a) font-size (b) text-align (c) background-color (d) color
  15. 15.✍️ Which property is set to bold in this rule?
    .note {
      font-style: italic;
      font-weight: bold;
    }
    (a) font-weight (b) bold (c) border (d) width
  16. 16.🌈 In #0000c8 the blue part is the hex number c8. What is it as a normal number?
  17. 17.⚖️ What colour is the text of this element?
    <p class="box" id="hero">Hi</p>
    CSS:
    #hero { color: white; }
    .box { color: purple; }
    p { color: red; }
    (a) purple (b) blue (c) white (d) red
  18. 18.🧩 Which language makes a form box? (a) HTML (b) CSS (c) JavaScript
  19. 19.⚖️ Which selector is the weakest? (a) an element selector (b) a class selector (c) an id selector
  20. 20.⚖️ What colour is the text of this element?
    <p class="menu" id="top">Hi</p>
    CSS:
    .menu { color: purple; }
    .menu { color: red; }
    (a) yellow (b) blue (c) red (d) purple
  21. 21.📦 In the box model, which part is space outside the border? (a) border (b) content (c) margin (d) padding
  22. 22.⚖️ What colour is the text of this element?
    <h2 class="big" id="intro">Hi</h2>
    CSS:
    h2 { color: black; }
    .big { color: red; }
    (a) red (b) purple (c) orange (d) black
  23. 23.True or false: .menu is an element selector. (a) True (b) False
  24. 24.True or false: padding is space inside the border. (a) False (b) True
  25. 25.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 14px;
      }
    }
    (a) Yes (b) No
  26. 26.🌈 In #rrggbb, which colour do the first two digits give? (a) red (b) black (c) blue (d) green
  27. 27.📱 What does a media query check? (a) the page title (b) the battery level (c) the time of day (d) the screen width
  28. 28.📱 Responsive design means a page ___. (a) fits every screen (b) has no pictures (c) never changes (d) is only for laptops
  29. 29.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 4 (b) 3 (c) 2 (d) 6
  30. 30.⚖️ Two rules with the same selector set a colour. Which one wins? (a) neither (b) the later one (c) the shorter one (d) the first one
  31. 31.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 410px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 80px wide (no margins).
  32. 32.True or false: JavaScript adds space around boxes. (a) True (b) False
  33. 33.🎯 How many elements on a page should have the same id? (a) any number (b) 2 (c) 5 (d) 1
  34. 34.⚖️ Which selector is the strongest? (a) an id selector (b) an element selector (c) a class selector
  35. 35.🖌️ Where does the text sit on its line?
    li {
      background-color: red;
      font-size: 16px;
      text-align: left;
      color: orange;
    }
    (a) in the middle (b) on the left (c) on the right
  36. 36.🌈 Which colour is rgb(0, 255, 255)? (a) bright green (b) cyan (c) white (d) red
  37. 37.🖌️ What colour is behind the letters?
    h1 {
      font-size: 40px;
      background-color: yellow;
      text-align: left;
      color: white;
    }
    (a) yellow (b) white (c) blue
  38. 38.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 220px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 50px wide (no margins).
  39. 39.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 160px;
      padding: 30px;
      border: 4px solid black;
      margin: 15px;
    }
  40. 40.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      text-align: center;
    }

Answer key

  1. :
  2. border
  3. makes letters bigger
  4. bold
  5. CSS
  6. border
  7. white
  8. reacts to a button click
  9. 126
  10. #0000ff
  11. purple
  12. center
  13. display: flex
  14. color
  15. font-weight
  16. 200
  17. white
  18. HTML
  19. an element selector
  20. red
  21. margin
  22. red
  23. False
  24. True
  25. No
  26. red
  27. the screen width
  28. fits every screen
  29. 3
  30. the later one
  31. 30
  32. False
  33. 1
  34. an id selector
  35. on the left
  36. cyan
  37. yellow
  38. 70
  39. 258
  40. 1

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