← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 783 · 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 the text bold (b) centres a heading (c) makes letters bigger (d) sets the letter colour
  2. 2.🔍 Which is the odd one out? (a) adds space around boxes (b) sets colours and fonts (c) reacts to a button click (d) lays out the page
  3. 3.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 18px;
      }
    }
    (a) No (b) Yes
  4. 4.🎯 Which element does the selector p style? (a) <h2 class="note"> (b) <li id="top"> (c) <h1> (d) <p class="note">
  5. 5.🖌️ How big is the text, in px?
    li {
      text-align: center;
      font-size: 20px;
      color: white;
      background-color: green;
    }
  6. 6.⚖️ Which selector is the weakest? (a) an element selector (b) an id selector (c) a class selector
  7. 7.🧩 Which language shows a pop-up message? (a) CSS (b) HTML (c) JavaScript
  8. 8.What does justify-content: flex-start do? (a) puts boxes in the middle (b) packs boxes at the start (c) equal gaps, none at ends (d) packs boxes at the end
  9. 9.⚖️ What colour is the text of this element?
    <h1 class="red" id="logo">Hi</h1>
    CSS:
    h1 { color: white; }
    h1 { color: green; }
    (a) green (b) purple (c) yellow (d) white
  10. 10.🔍 Which is the odd one out? (a) gives the page structure (b) changes the text size (c) lays out the page (d) sets colours and fonts
  11. 11.What does font-size do? (a) centres a heading (b) sets the letter colour (c) colours behind the text (d) makes letters bigger
  12. 12.🌈 Which colour of light is strongest in rgb(103, 255, 102)? (a) green (b) blue (c) red
  13. 13.✍️ Which sign ends each CSS declaration? (a) ; (b) , (c) . (d) :
  14. 14.What does font-weight do? (a) makes letters bigger (b) sets the letter colour (c) makes the text bold (d) colours behind the text
  15. 15.📱 The screen is 820px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 10px;
      }
    }
    (a) Yes (b) No
  16. 16.📦 In the box model, which part is space inside the border? (a) content (b) padding (c) margin (d) border
  17. 17.✍️ Which sign goes between a property and its value? (a) = (b) - (c) : (d) ;
  18. 18.🖌️ What colour are the letters?
    h1 {
      font-size: 36px;
      color: red;
      background-color: blue;
      text-align: center;
    }
    (a) blue (b) red (c) yellow
  19. 19.🎯 Which element does the selector div style? (a) <h1 id="intro"> (b) <p class="menu"> (c) <span> (d) <div class="menu">
  20. 20.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 10px;
      }
    }
  21. 21.⚖️ 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
  22. 22.🎯 What kind of selector is li? (a) an id selector (b) a class selector (c) an element selector
  23. 23.🌈 Which colour is #000000? (a) bright green (b) white (c) yellow (d) black
  24. 24.🎯 What kind of selector is #logo? (a) an element selector (b) an id selector (c) a class selector
  25. 25.True or false: HTML lays out the page. (a) True (b) False
  26. 26.📱 What does a media query check? (a) the time of day (b) the battery level (c) the page title (d) the screen width
  27. 27.⚖️ Which selector is the strongest? (a) an element selector (b) an id selector (c) a class selector
  28. 28.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 14px;
      }
    }
    (a) No (b) Yes
  29. 29.🎯 What kind of selector is .big? (a) an element selector (b) an id selector (c) a class selector
  30. 30.🔍 Which is the odd one out? (a) checks a quiz answer (b) makes headings and lists (c) puts a picture on a page (d) makes a form box
  31. 31.True or false: CSS sets colours and fonts. (a) False (b) True
  32. 32.🔍 Which is the odd one out? (a) reacts to a button click (b) changes the page live (c) sets colours and fonts (d) checks a quiz answer
  33. 33.🖌️ Which CSS property centres a heading? (a) font-family (b) background-color (c) text-align (d) font-size
  34. 34.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 22px;
      }
    }
    (a) No (b) Yes
  35. 35.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      width: 300px;
      font-style: italic;
      padding: 8px;
      font-size: 20px;
    }
  36. 36.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 230px;
      padding: 5px;
      border: 2px solid black;
      margin: 15px;
    }
  37. 37.📱 The screen is 820px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 10px;
      }
    }
    (a) No (b) Yes
  38. 38.💪 Which justify-content value packs boxes at the start? (a) flex-end (b) center (c) flex-start (d) space-between
  39. 39.⚖️ What colour is the text of this element?
    <h1 class="box" id="intro">Hi</h1>
    CSS:
    #intro { color: yellow; }
    #intro { color: white; }
    (a) red (b) white (c) yellow (d) black
  40. 40.🎯 Which CSS selector matches this element?
    <h2 class="red" id="top">Hello</h2>
    (a) #top (b) #red (c) li (d) .top

Answer key

  1. centres a heading
  2. reacts to a button click
  3. Yes
  4. <p class="note">
  5. 20
  6. an element selector
  7. JavaScript
  8. packs boxes at the start
  9. green
  10. gives the page structure
  11. makes letters bigger
  12. green
  13. ;
  14. makes the text bold
  15. No
  16. padding
  17. :
  18. red
  19. <div class="menu">
  20. 10
  21. the later one
  22. an element selector
  23. black
  24. an id selector
  25. False
  26. the screen width
  27. an id selector
  28. Yes
  29. a class selector
  30. checks a quiz answer
  31. True
  32. sets colours and fonts
  33. text-align
  34. Yes
  35. 4
  36. 274
  37. No
  38. flex-start
  39. white
  40. #top

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