← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 334 · 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 justify-content value packs boxes at the start? (a) center (b) flex-end (c) flex-start (d) space-between
  2. 2.✍️ What value is given to margin in this rule?
    #top {
      margin: 10px;
      color: red;
      width: 300px;
      font-weight: bold;
    }
    (a) bold (b) margin (c) 10px (d) 8px
  3. 3.✍️ Which sign ends each CSS declaration? (a) ; (b) . (c) : (d) ,
  4. 4.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 24px;
      }
    }
    (a) No (b) Yes
  5. 5.🌈 Which colour is rgb(255, 0, 255)? (a) white (b) black (c) magenta (d) bright green
  6. 6.🌈 Which hex code is white? (a) #00ff00 (b) #000000 (c) #ffffff (d) #0000ff
  7. 7.True or false: HTML adds space around boxes. (a) True (b) False
  8. 8.🌈 In #006500 the green part is the hex number 65. What is it as a normal number?
  9. 9.🎨 Which tag holds CSS inside the head? (a) <script> (b) <body> (c) <style> (d) <css>
  10. 10.Which of these does HTML do? (a) gives the page structure (b) lays out the page (c) adds space around boxes (d) checks a quiz answer
  11. 11.⚖️ What colour is the text of this element?
    <p class="red" id="logo">Hi</p>
    CSS:
    .red { color: green; }
    p { color: yellow; }
    #logo { color: blue; }
    (a) green (b) blue (c) orange (d) yellow
  12. 12.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 110px;
      padding: 5px;
      border: 5px solid black;
      margin: 20px;
    }
  13. 13.True or false: CSS counts down a timer. (a) True (b) False
  14. 14.🎯 Which CSS selector matches this element?
    <div class="box" id="hero">Hello</div>
    (a) #top (b) span (c) div (d) #box
  15. 15.📦 In the box model, which part is a solid or dotted edge? (a) content (b) margin (c) border (d) padding
  16. 16.⚖️ Which selector is the strongest? (a) an element selector (b) an id selector (c) a class selector
  17. 17.What does text-align do? (a) sets the letter colour (b) makes letters bigger (c) colours behind the text (d) centres a heading
  18. 18.📦 In the box model, which part is space outside the border? (a) content (b) border (c) margin (d) padding
  19. 19.⚖️ What colour is the text of this element?
    <p class="star" id="logo">Hi</p>
    CSS:
    #logo { color: green; }
    #logo { color: yellow; }
    (a) green (b) yellow (c) orange (d) white
  20. 20.📱 The screen is 1366px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 22px;
      }
    }
    (a) Yes (b) No
  21. 21.📱 min-width: 800px applies when the screen is ___. (a) 800px or wider (b) turned off (c) 800px or narrower (d) exactly 100px
  22. 22.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 18px;
      }
    }
    (a) Yes (b) No
  23. 23.🖌️ Which CSS property makes letters bigger? (a) background-color (b) color (c) font-weight (d) font-size
  24. 24.✍️ How does a CSS comment start? (a) /* (b) // (c) # (d) <!--
  25. 25.🔍 Which is the odd one out? (a) shows a pop-up message (b) checks a quiz answer (c) changes the page live (d) gives the page structure
  26. 26.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 6px;
      }
    }
    (a) No (b) Yes
  27. 27.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 14px;
      }
    }
    (a) No (b) Yes
  28. 28.🎯 Which CSS selector matches this element?
    <p class="box" id="end">Hello</p>
    (a) #box (b) .end (c) .box (d) .star
  29. 29.True or false: JavaScript reacts to a button click. (a) True (b) False
  30. 30.🖌️ Which CSS property colours behind the text? (a) background-color (b) font-weight (c) text-align (d) font-family
  31. 31.True or false: .menu is an element selector. (a) True (b) False
  32. 32.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 160px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  33. 33.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 330px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 60px wide (no margins).
  34. 34.✍️ CSS declarations go inside which brackets? (a) < > (b) ( ) (c) { } (d) [ ]
  35. 35.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 22px;
      }
    }
    (a) Yes (b) No
  36. 36.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 220px;
      padding: 5px;
      border: 2px solid black;
      margin: 0px;
    }
  37. 37.⚖️ What colour is the text of this element?
    <h1 class="box" id="top">Hi</h1>
    CSS:
    .box { color: blue; }
    .box { color: purple; }
    (a) purple (b) white (c) black (d) blue
  38. 38.🧩 Which language makes headings and lists? (a) HTML (b) JavaScript (c) CSS
  39. 39.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 10px;
      }
    }
  40. 40.✍️ How many declarations (property: value pairs) are in this rule?
    #top {
      margin: 10px;
    }

Answer key

  1. flex-start
  2. 10px
  3. ;
  4. No
  5. magenta
  6. #ffffff
  7. False
  8. 101
  9. <style>
  10. gives the page structure
  11. blue
  12. 170
  13. False
  14. div
  15. border
  16. an id selector
  17. centres a heading
  18. margin
  19. yellow
  20. No
  21. 800px or wider
  22. No
  23. font-size
  24. /*
  25. gives the page structure
  26. Yes
  27. No
  28. .box
  29. True
  30. background-color
  31. False
  32. 60
  33. 30
  34. { }
  35. Yes
  36. 234
  37. purple
  38. HTML
  39. 12
  40. 1

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