← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 417 · 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 sign starts a class selector? (a) # (b) & (c) . (d) @
  2. 2.✍️ Which property is set to 20px in this rule?
    .note {
      font-style: italic;
      font-weight: bold;
      font-size: 20px;
    }
    (a) background-color (b) text-align (c) font-size (d) 20px
  3. 3.True or false: margin is space inside the border. (a) False (b) True
  4. 4.✍️ Which sign ends each CSS declaration? (a) : (b) . (c) ; (d) ,
  5. 5.🎯 Which CSS selector matches this element?
    <h1 class="note" id="logo">Hello</h1>
    (a) .note (b) #note (c) h2 (d) #end
  6. 6.📦 In the box model, which part is the text or picture? (a) content (b) margin (c) border (d) padding
  7. 7.💪 Which flexbox property spaces boxes along a row? (a) display: flex (b) align-items (c) gap (d) justify-content
  8. 8.✍️ What is the selector in this CSS rule?
    p {
      background-color: yellow;
      padding: 8px;
      margin: 10px;
      color: red;
    }
    (a) .note (b) background-color (c) 8px (d) p
  9. 9.✍️ What is the selector in this CSS rule?
    .box {
      font-size: 20px;
      background-color: yellow;
      text-align: center;
    }
    (a) h2 (b) font-size (c) .box (d) yellow
  10. 10.🌈 In #00ec00 the green part is the hex number ec. What is it as a normal number?
  11. 11.🧩 Which language puts a picture on a page? (a) JavaScript (b) HTML (c) CSS
  12. 12.🖌️ What colour are the letters?
    h1 {
      background-color: orange;
      color: green;
      text-align: right;
      font-size: 20px;
    }
    (a) orange (b) black (c) green
  13. 13.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) turned off (c) 800px or wider (d) exactly 100px
  14. 14.🎨 Which tag connects an outside CSS file? (a) <a> (b) <css> (c) <link> (d) <img>
  15. 15.🎯 Which CSS selector matches this element?
    <h1 class="note" id="end">Hello</h1>
    (a) .big (b) #note (c) #end (d) #hero
  16. 16.✍️ What value is given to text-align in this rule?
    p {
      font-weight: bold;
      text-align: center;
    }
    (a) 10px (b) yellow (c) text-align (d) center
  17. 17.🔍 Which is the odd one out? (a) puts a picture on a page (b) makes headings and lists (c) shows a pop-up message (d) makes a link
  18. 18.🎨 What does CSS stand for? (a) Cascading Style Sheets (b) Computer Style Sheets (c) Colourful Site Styles (d) Creative Sheet System
  19. 19.What does text-align do? (a) makes the text bold (b) colours behind the text (c) centres a heading (d) sets the letter colour
  20. 20.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 18px;
      }
    }
  21. 21.🎯 Which element does the selector .note style? (a) <span id="note"> (b) <span class="big"> (c) <span class="note"> (d) <p class="red">
  22. 22.🎯 Which CSS selector matches this element?
    <li class="menu" id="top">Hello</li>
    (a) #intro (b) #menu (c) .note (d) #top
  23. 23.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      font-weight: bold;
      background-color: yellow;
    }
  24. 24.🌈 In #rrggbb, which colour do the first two digits give? (a) black (b) red (c) blue (d) green
  25. 25.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 8px;
      }
    }
    (a) No (b) Yes
  26. 26.True or false: JavaScript gives the page structure. (a) True (b) False
  27. 27.🌈 In #e30000 the red part is the hex number e3. What is it as a normal number?
  28. 28.📦 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: 25px;
      border: 4px solid black;
      margin: 10px;
    }
  29. 29.⚖️ What colour is the text of this element?
    <p class="note" id="main">Hi</p>
    CSS:
    p { color: yellow; }
    .note { color: blue; }
    #main { color: green; }
    (a) blue (b) yellow (c) purple (d) green
  30. 30.🌈 Which colour is #000000? (a) black (b) yellow (c) bright green (d) blue
  31. 31.True or false: CSS changes the text size. (a) False (b) True
  32. 32.🎯 Which CSS selector matches this element?
    <p class="red" id="intro">Hello</p>
    (a) h1 (b) #main (c) .box (d) p
  33. 33.Which of these does JavaScript do? (a) sets colours and fonts (b) makes a link (c) puts a picture on a page (d) checks a quiz answer
  34. 34.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 2 (b) 6 (c) 4 (d) 3
  35. 35.🎯 Can many elements share the same class? (a) No (b) Yes
  36. 36.⚖️ Two rules with the same selector set a colour. Which one wins? (a) neither (b) the later one (c) the first one (d) the shorter one
  37. 37.✍️ What is the selector in this CSS rule?
    h2 {
      text-align: center;
      margin: 10px;
    }
    (a) text-align (b) h2 (c) 10px (d) h1
  38. 38.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 10px;
      }
    }
  39. 39.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 280px;
      justify-content: space-between;
    }
    Inside are 3 boxes, each 80px wide (no margins).
  40. 40.📦 In the box model, which part is space outside the border? (a) border (b) content (c) margin (d) padding

Answer key

  1. .
  2. font-size
  3. False
  4. ;
  5. .note
  6. content
  7. justify-content
  8. p
  9. .box
  10. 236
  11. HTML
  12. green
  13. 800px or wider
  14. <link>
  15. #end
  16. center
  17. shows a pop-up message
  18. Cascading Style Sheets
  19. centres a heading
  20. 18
  21. <span class="note">
  22. #top
  23. 2
  24. red
  25. No
  26. False
  27. 227
  28. 288
  29. green
  30. black
  31. True
  32. p
  33. checks a quiz answer
  34. 3
  35. Yes
  36. the later one
  37. h2
  38. 10
  39. 20
  40. margin

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