← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 513 · 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 language adds space around boxes? (a) HTML (b) JavaScript (c) CSS
  2. 2.🖌️ Which CSS property sets the letter colour? (a) font-family (b) background-color (c) color (d) font-size
  3. 3.⚖️ What colour is the text of this element?
    <h2 class="menu" id="logo">Hi</h2>
    CSS:
    .menu { color: red; }
    h2 { color: yellow; }
    #logo { color: purple; }
    (a) purple (b) red (c) white (d) yellow
  4. 4.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 8px;
      }
    }
    (a) Yes (b) No
  5. 5.🖌️ Which CSS property picks the font style? (a) color (b) text-align (c) font-family (d) font-weight
  6. 6.📱 max-width: 600px applies when the screen is ___. (a) 600px or wider (b) turned off (c) exactly 1000px (d) 600px or narrower
  7. 7.⚖️ What colour is the text of this element?
    <h1 class="box" id="logo">Hi</h1>
    CSS:
    h1 { color: yellow; }
    .box { color: black; }
    (a) blue (b) purple (c) black (d) yellow
  8. 8.Which of these does CSS do? (a) changes the page live (b) changes the text size (c) puts a picture on a page (d) makes headings and lists
  9. 9.What does font-weight do? (a) makes the text bold (b) colours behind the text (c) makes letters bigger (d) sets the letter colour
  10. 10.✍️ How many declarations (property: value pairs) are in this rule?
    .box {
      font-weight: bold;
    }
  11. 11.🖌️ Where does the text sit on its line?
    h2 {
      text-align: left;
      color: white;
      background-color: blue;
      font-size: 20px;
    }
    (a) on the right (b) in the middle (c) on the left
  12. 12.📦 In the box model, which part is space outside the border? (a) padding (b) content (c) border (d) margin
  13. 13.🌈 In #440000 the red part is the hex number 44. What is it as a normal number?
  14. 14.🌈 Which colour of light is strongest in rgb(55, 180, 58)? (a) red (b) blue (c) green
  15. 15.⚖️ Which selector is the strongest? (a) an id selector (b) an element selector (c) a class selector
  16. 16.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 110px;
      padding: 30px;
      border: 3px solid black;
      margin: 20px;
    }
  17. 17.⚖️ What colour is the text of this element?
    <p class="big" id="logo">Hi</p>
    CSS:
    .big { color: yellow; }
    #logo { color: white; }
    p { color: orange; }
    (a) white (b) black (c) yellow (d) orange
  18. 18.⚖️ What colour is the text of this element?
    <h1 class="menu" id="hero">Hi</h1>
    CSS:
    #hero { color: blue; }
    #hero { color: orange; }
    (a) white (b) orange (c) black (d) blue
  19. 19.🎯 Can many elements share the same class? (a) No (b) Yes
  20. 20.🎯 Which sign starts an id selector? (a) @ (b) . (c) # (d) &
  21. 21.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 14px;
      }
    }
  22. 22.🎨 Which tag holds CSS inside the head? (a) <css> (b) <script> (c) <body> (d) <style>
  23. 23.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 110px;
      padding: 25px;
      border: 1px solid black;
      margin: 0px;
    }
  24. 24.🌈 Which hex code is red? (a) #00ffff (b) #ff00ff (c) #0000ff (d) #ff0000
  25. 25.✍️ Which property is set to center in this rule?
    p {
      margin: 10px;
      text-align: center;
    }
    (a) background-color (b) text-align (c) center (d) margin
  26. 26.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 180px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  27. 27.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 22px;
      }
    }
    (a) No (b) Yes
  28. 28.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      border: 2px solid;
    }
  29. 29.🖌️ Which CSS property makes the text bold? (a) color (b) font-size (c) font-family (d) font-weight
  30. 30.⚖️ Two rules with the same selector set a colour. Which one wins? (a) neither (b) the first one (c) the shorter one (d) the later one
  31. 31.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 180px;
      padding: 30px;
      border: 2px solid black;
      margin: 20px;
    }
  32. 32.🧩 Which language makes headings and lists? (a) CSS (b) HTML (c) JavaScript
  33. 33.🔍 Which is the odd one out? (a) checks a quiz answer (b) reacts to a button click (c) changes the page live (d) gives the page structure
  34. 34.True or false: padding is the text or picture. (a) False (b) True
  35. 35.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 130px;
      padding: 10px;
      border: 4px solid black;
      margin: 20px;
    }
  36. 36.🔍 Which is the odd one out? (a) makes a link (b) puts a picture on a page (c) rounds box corners (d) makes headings and lists
  37. 37.🌈 What is the biggest number one colour can have in rgb()? (a) 1000 (b) 255 (c) 100 (d) 99
  38. 38.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 260px;
      justify-content: center;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  39. 39.🎯 Which element does the selector span style? (a) <h1 class="note"> (b) <span class="note"> (c) <p> (d) <h2 id="top">
  40. 40.✍️ What is the selector in this CSS rule?
    p {
      color: red;
      background-color: yellow;
    }
    (a) .note (b) yellow (c) p (d) color

Answer key

  1. CSS
  2. color
  3. purple
  4. Yes
  5. font-family
  6. 600px or narrower
  7. black
  8. changes the text size
  9. makes the text bold
  10. 1
  11. on the left
  12. margin
  13. 68
  14. green
  15. an id selector
  16. 176
  17. white
  18. orange
  19. Yes
  20. #
  21. 14
  22. <style>
  23. 162
  24. #ff0000
  25. text-align
  26. 80
  27. No
  28. 1
  29. font-weight
  30. the later one
  31. 284
  32. HTML
  33. gives the page structure
  34. False
  35. 198
  36. rounds box corners
  37. 255
  38. 50
  39. <span class="note">
  40. p

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