← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 877 · 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 colour is the text of this element?
    <h1 class="big" id="top">Hi</h1>
    CSS:
    h1 { color: red; }
    h1 { color: blue; }
    (a) red (b) black (c) blue (d) white
  2. 2.✍️ What is the selector in this CSS rule?
    h2 {
      font-size: 20px;
      color: red;
    }
    (a) red (b) h1 (c) font-size (d) h2
  3. 3.What does color do? (a) sets the letter colour (b) colours behind the text (c) makes letters bigger (d) makes the text bold
  4. 4.✍️ Which sign ends each CSS declaration? (a) . (b) : (c) ; (d) ,
  5. 5.True or false: margin is space outside the border. (a) True (b) False
  6. 6.🌈 Which hex code is white? (a) #000000 (b) #ff0000 (c) #ffffff (d) #00ff00
  7. 7.🎯 Which CSS selector matches this element?
    <h2 class="big" id="main">Hello</h2>
    (a) #big (b) h2 (c) #logo (d) .main
  8. 8.🧩 Which language counts down a timer? (a) HTML (b) JavaScript (c) CSS
  9. 9.💪 Which flexbox property turns on flexbox? (a) align-items (b) display: flex (c) flex-direction (d) justify-content
  10. 10.Which of these does JavaScript do? (a) gives the page structure (b) checks a quiz answer (c) changes the text size (d) puts a picture on a page
  11. 11.🌈 In #630000 the red part is the hex number 63. What is it as a normal number?
  12. 12.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 50px;
      padding: 20px;
      border: 1px solid black;
      margin: 5px;
    }
  13. 13.🖌️ Where does the text sit on its line?
    h2 {
      font-size: 40px;
      color: blue;
      background-color: red;
      text-align: center;
    }
    (a) in the middle (b) on the left (c) on the right
  14. 14.True or false: body is an id selector. (a) True (b) False
  15. 15.📱 Which tag helps phones show a page at the right size? (a) the viewport meta tag (b) the title tag (c) the hr tag (d) the br tag
  16. 16.🖌️ How big is the text, in px?
    p {
      color: green;
      font-size: 20px;
      background-color: yellow;
      text-align: center;
    }
  17. 17.✍️ What is the selector in this CSS rule?
    #top {
      color: red;
      width: 300px;
    }
    (a) #top (b) 300px (c) li (d) color
  18. 18.True or false: CSS lays out the page. (a) True (b) False
  19. 19.🎯 Which sign starts an id selector? (a) @ (b) # (c) . (d) &
  20. 20.Which of these is padding? (a) the gap round content (b) the line round the box (c) the text or picture (d) space outside the border
  21. 21.🌈 Which colour of light is strongest in rgb(152, 29, 61)? (a) blue (b) red (c) green
  22. 22.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) exactly 100px (c) 800px or wider (d) turned off
  23. 23.Which of these does CSS do? (a) makes a form box (b) checks a quiz answer (c) lays out the page (d) changes the page live
  24. 24.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 14px;
      }
    }
  25. 25.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the later one (b) the first one (c) neither (d) the shorter one
  26. 26.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 230px;
      padding: 5px;
      border: 2px solid black;
      margin: 20px;
    }
  27. 27.✍️ Which property is set to 20px in this rule?
    .box {
      text-align: center;
      background-color: yellow;
      font-size: 20px;
    }
    (a) background-color (b) text-align (c) 20px (d) font-size
  28. 28.🧩 Which language puts a picture on a page? (a) CSS (b) JavaScript (c) HTML
  29. 29.🌈 Which colour is rgb(255, 0, 255)? (a) magenta (b) black (c) red (d) yellow
  30. 30.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 30px;
      }
    }
    (a) No (b) Yes
  31. 31.🎯 Which element does the selector #end style? (a) <h2 class="end"> (b) <h2 id="hero"> (c) <li class="note"> (d) <h2 id="end">
  32. 32.✍️ Which sign goes between a property and its value? (a) : (b) = (c) ; (d) -
  33. 33.⚖️ Which selector is the strongest? (a) an element selector (b) a class selector (c) an id selector
  34. 34.🌈 In #000048 the blue part is the hex number 48. What is it as a normal number?
  35. 35.🎯 Which CSS selector matches this element?
    <li class="red" id="intro">Hello</li>
    (a) .box (b) #intro (c) div (d) #main
  36. 36.True or false: JavaScript shows a pop-up message. (a) True (b) False
  37. 37.True or false: padding is the gap to other boxes. (a) True (b) False
  38. 38.🧩 Which language makes headings and lists? (a) CSS (b) JavaScript (c) HTML
  39. 39.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 170px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  40. 40.🌈 In #rrggbb, which colour do the first two digits give? (a) black (b) green (c) blue (d) red

Answer key

  1. blue
  2. h2
  3. sets the letter colour
  4. ;
  5. True
  6. #ffffff
  7. h2
  8. JavaScript
  9. display: flex
  10. checks a quiz answer
  11. 99
  12. 102
  13. in the middle
  14. False
  15. the viewport meta tag
  16. 20
  17. #top
  18. True
  19. #
  20. the gap round content
  21. red
  22. 800px or wider
  23. lays out the page
  24. 14
  25. the later one
  26. 244
  27. font-size
  28. HTML
  29. magenta
  30. No
  31. <h2 id="end">
  32. :
  33. an id selector
  34. 72
  35. #intro
  36. True
  37. False
  38. HTML
  39. 70
  40. red

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