← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 228 · 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.✍️ What value is given to border in this rule?
    #top {
      font-weight: bold;
      padding: 8px;
      border: 2px solid;
    }
    (a) border (b) 300px (c) italic (d) 2px solid
  2. 2.🎯 Can many elements share the same class? (a) Yes (b) No
  3. 3.Which of these is padding? (a) a solid or dotted edge (b) the gap to other boxes (c) the line round the box (d) the gap round content
  4. 4.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the first one (b) the later one (c) the shorter one (d) neither
  5. 5.📱 max-width: 600px applies when the screen is ___. (a) exactly 1000px (b) 600px or wider (c) 600px or narrower (d) turned off
  6. 6.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 300px;
      padding: 10px;
      border: 4px solid black;
      margin: 0px;
    }
  7. 7.🎨 One CSS file can style how many pages? (a) only one image (b) no pages (c) only one word (d) many pages
  8. 8.📦 In the box model, which part is the gap to other boxes? (a) padding (b) content (c) border (d) margin
  9. 9.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 170px;
      padding: 10px;
      border: 3px solid black;
      margin: 5px;
    }
  10. 10.🌈 In #000041 the blue part is the hex number 41. What is it as a normal number?
  11. 11.🌈 Which hex code is magenta? (a) #000000 (b) #ffff00 (c) #ff00ff (d) #00ffff
  12. 12.Which of these does HTML do? (a) adds space around boxes (b) changes the text size (c) shows a pop-up message (d) makes headings and lists
  13. 13.🌈 Which colour is rgb(255, 255, 255)? (a) blue (b) black (c) yellow (d) white
  14. 14.⚖️ What colour is the text of this element?
    <h1 class="big" id="top">Hi</h1>
    CSS:
    .big { color: red; }
    #top { color: blue; }
    h1 { color: green; }
    (a) blue (b) yellow (c) green (d) red
  15. 15.✍️ How does a CSS comment start? (a) /* (b) // (c) # (d) <!--
  16. 16.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 10px;
      }
    }
  17. 17.🔍 Which is the odd one out? (a) rounds box corners (b) adds space around boxes (c) sets colours and fonts (d) makes headings and lists
  18. 18.What does font-size do? (a) makes the text bold (b) makes letters bigger (c) colours behind the text (d) picks the font style
  19. 19.🧩 Which language counts down a timer? (a) HTML (b) JavaScript (c) CSS
  20. 20.🎯 Which CSS selector matches this element?
    <h2 class="red" id="top">Hello</h2>
    (a) #top (b) .top (c) #intro (d) .box
  21. 21.True or false: HTML puts a picture on a page. (a) True (b) False
  22. 22.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 160px;
      padding: 20px;
      border: 1px solid black;
      margin: 10px;
    }
  23. 23.🎨 A CSS file usually ends with which extension? (a) .js (b) .png (c) .css (d) .html
  24. 24.✍️ Which property is set to 8px in this rule?
    #top {
      padding: 8px;
      background-color: yellow;
      font-size: 20px;
      text-align: center;
    }
    (a) 8px (b) padding (c) border (d) font-weight
  25. 25.🌈 Which colour is rgb(0, 0, 0)? (a) black (b) cyan (c) bright green (d) yellow
  26. 26.✍️ In color: blue; which part is the property? (a) blue (b) : (c) color (d) ;
  27. 27.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 400px;
      justify-content: center;
    }
    Inside are 4 boxes, each 80px wide (no margins).
  28. 28.🎯 Which CSS selector matches this element?
    <li class="star" id="top">Hello</li>
    (a) .menu (b) #intro (c) .star (d) .top
  29. 29.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 200px;
      padding: 10px;
      border: 2px solid black;
      margin: 5px;
    }
  30. 30.📱 min-width: 800px applies when the screen is ___. (a) exactly 100px (b) 800px or narrower (c) 800px or wider (d) turned off
  31. 31.True or false: p is an element selector. (a) True (b) False
  32. 32.💪 Which flexbox property spaces boxes along a row? (a) gap (b) align-items (c) display: flex (d) justify-content
  33. 33.Which of these does JavaScript do? (a) makes headings and lists (b) makes a form box (c) puts a picture on a page (d) reacts to a button click
  34. 34.⚖️ What colour is the text of this element?
    <h1 class="big" id="logo">Hi</h1>
    CSS:
    #logo { color: green; }
    #logo { color: black; }
    (a) orange (b) purple (c) black (d) green
  35. 35.📦 In the box model, which part is a solid or dotted edge? (a) padding (b) border (c) margin (d) content
  36. 36.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 3 (b) 2 (c) 4 (d) 6
  37. 37.What does background-color do? (a) makes letters bigger (b) makes the text bold (c) sets the letter colour (d) colours behind the text
  38. 38.🎯 What kind of selector is .note? (a) an id selector (b) a class selector (c) an element selector
  39. 39.📦 In the box model, which part is space inside the border? (a) padding (b) margin (c) border (d) content
  40. 40.📱 Responsive design means a page ___. (a) is only for laptops (b) fits every screen (c) has no pictures (d) never changes

Answer key

  1. 2px solid
  2. Yes
  3. the gap round content
  4. the later one
  5. 600px or narrower
  6. 328
  7. many pages
  8. margin
  9. 206
  10. 65
  11. #ff00ff
  12. makes headings and lists
  13. white
  14. blue
  15. /*
  16. 10
  17. makes headings and lists
  18. makes letters bigger
  19. JavaScript
  20. #top
  21. True
  22. 222
  23. .css
  24. padding
  25. black
  26. color
  27. 40
  28. .star
  29. 234
  30. 800px or wider
  31. True
  32. justify-content
  33. reacts to a button click
  34. black
  35. border
  36. 3
  37. colours behind the text
  38. a class selector
  39. padding
  40. fits every screen

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