← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 802 · 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 does text-align do? (a) makes letters bigger (b) makes the text bold (c) sets the letter colour (d) centres a heading
  2. 2.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 220px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  3. 3.🧩 Which language puts a picture on a page? (a) JavaScript (b) CSS (c) HTML
  4. 4.🌈 Which colour is rgb(255, 255, 0)? (a) bright green (b) blue (c) cyan (d) yellow
  5. 5.True or false: JavaScript adds space around boxes. (a) True (b) False
  6. 6.✍️ In color: blue; which part is the property? (a) blue (b) ; (c) color (d) :
  7. 7.🔍 Which is the odd one out? (a) sets colours and fonts (b) reacts to a button click (c) adds space around boxes (d) lays out the page
  8. 8.True or false: p is a class selector. (a) False (b) True
  9. 9.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 280px;
      padding: 10px;
      border: 4px solid black;
      margin: 10px;
    }
  10. 10.🌈 Which colour is rgb(0, 255, 0)? (a) black (b) magenta (c) blue (d) bright green
  11. 11.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 16px;
      }
    }
  12. 12.⚖️ What colour is the text of this element?
    <h1 class="menu" id="end">Hi</h1>
    CSS:
    .menu { color: black; }
    #end { color: blue; }
    (a) red (b) green (c) blue (d) black
  13. 13.🌈 In #00f500 the green part is the hex number f5. What is it as a normal number?
  14. 14.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 32px;
      }
    }
    (a) Yes (b) No
  15. 15.⚖️ What colour is the text of this element?
    <p class="box" id="top">Hi</p>
    CSS:
    p { color: purple; }
    .box { color: green; }
    (a) purple (b) white (c) green (d) yellow
  16. 16.🎯 Which CSS selector matches this element?
    <p class="star" id="end">Hello</p>
    (a) #hero (b) p (c) h1 (d) #star
  17. 17.True or false: HTML makes a form box. (a) True (b) False
  18. 18.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 40px;
      padding: 10px;
      border: 5px solid black;
      margin: 10px;
    }
  19. 19.💪 Which justify-content value puts boxes in the middle? (a) center (b) space-between (c) flex-end (d) flex-start
  20. 20.🌈 Which colour is #ff0000? (a) magenta (b) white (c) yellow (d) red
  21. 21.⚖️ What colour is the text of this element?
    <p class="box" id="end">Hi</p>
    CSS:
    .box { color: yellow; }
    .box { color: blue; }
    (a) purple (b) blue (c) red (d) yellow
  22. 22.🔍 Which is the odd one out? (a) counts down a timer (b) changes the page live (c) shows a pop-up message (d) adds space around boxes
  23. 23.Which of these does CSS do? (a) puts a picture on a page (b) sets colours and fonts (c) checks a quiz answer (d) shows a pop-up message
  24. 24.✍️ How does a CSS comment start? (a) /* (b) <!-- (c) // (d) #
  25. 25.🧩 Which language makes a form box? (a) HTML (b) JavaScript (c) CSS
  26. 26.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 28px;
      }
    }
    (a) Yes (b) No
  27. 27.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 8px;
      }
    }
    (a) No (b) Yes
  28. 28.🎨 A CSS file usually ends with which extension? (a) .js (b) .png (c) .css (d) .html
  29. 29.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 30px;
      }
    }
    (a) Yes (b) No
  30. 30.Which of these is the content? (a) space inside the border (b) a solid or dotted edge (c) the text or picture (d) the line round the box
  31. 31.🎯 Can many elements share the same class? (a) No (b) Yes
  32. 32.What does justify-content: center do? (a) packs boxes at the start (b) equal gaps, none at ends (c) packs boxes at the end (d) puts boxes in the middle
  33. 33.💪 Which justify-content value packs boxes at the start? (a) center (b) flex-start (c) flex-end (d) space-between
  34. 34.⚖️ What colour is the text of this element?
    <p class="box" id="intro">Hi</p>
    CSS:
    #intro { color: red; }
    p { color: yellow; }
    .box { color: purple; }
    (a) black (b) red (c) yellow (d) purple
  35. 35.🌈 In #00e900 the green part is the hex number e9. What is it as a normal number?
  36. 36.✍️ What is the selector in this CSS rule?
    h2 {
      padding: 8px;
      width: 300px;
      margin: 10px;
      background-color: yellow;
    }
    (a) h1 (b) h2 (c) padding (d) 300px
  37. 37.✍️ CSS declarations go inside which brackets? (a) ( ) (b) < > (c) { } (d) [ ]
  38. 38.✍️ What is the selector in this CSS rule?
    #top {
      margin: 10px;
      color: red;
    }
    (a) li (b) margin (c) red (d) #top
  39. 39.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 110px;
      padding: 30px;
      border: 1px solid black;
      margin: 5px;
    }
  40. 40.📱 max-width: 600px applies when the screen is ___. (a) turned off (b) 600px or wider (c) 600px or narrower (d) exactly 1000px

Answer key

  1. centres a heading
  2. 60
  3. HTML
  4. yellow
  5. False
  6. color
  7. reacts to a button click
  8. False
  9. 328
  10. bright green
  11. 20
  12. blue
  13. 245
  14. Yes
  15. green
  16. p
  17. True
  18. 90
  19. center
  20. red
  21. blue
  22. adds space around boxes
  23. sets colours and fonts
  24. /*
  25. HTML
  26. Yes
  27. Yes
  28. .css
  29. Yes
  30. the text or picture
  31. Yes
  32. puts boxes in the middle
  33. flex-start
  34. red
  35. 233
  36. h2
  37. { }
  38. #top
  39. 182
  40. 600px or narrower

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