← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 342 · 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 flexbox property lines boxes up across? (a) justify-content (b) flex-direction (c) display: flex (d) align-items
  2. 2.🎨 Which attribute adds CSS inside one tag? (a) style (b) href (c) alt (d) src
  3. 3.🎨 Which tag holds CSS inside the head? (a) <css> (b) <style> (c) <script> (d) <body>
  4. 4.📱 Responsive design means a page ___. (a) is only for laptops (b) has no pictures (c) never changes (d) fits every screen
  5. 5.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      border: 2px solid;
      margin: 10px;
      font-style: italic;
      padding: 8px;
    }
  6. 6.What does justify-content: space-between do? (a) packs boxes at the start (b) puts boxes in the middle (c) equal gaps, none at ends (d) packs boxes at the end
  7. 7.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 90px;
      padding: 10px;
      border: 4px solid black;
      margin: 10px;
    }
  8. 8.True or false: padding is space outside the border. (a) True (b) False
  9. 9.💪 Which flexbox property turns on flexbox? (a) align-items (b) display: flex (c) justify-content (d) gap
  10. 10.🔍 Which is the odd one out? (a) rounds box corners (b) changes the text size (c) sets colours and fonts (d) makes headings and lists
  11. 11.⚖️ Which selector is the weakest? (a) an element selector (b) an id selector (c) a class selector
  12. 12.📱 Which tag helps phones show a page at the right size? (a) the br tag (b) the viewport meta tag (c) the title tag (d) the hr tag
  13. 13.📦 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: 15px;
      border: 2px solid black;
      margin: 0px;
    }
  14. 14.⚖️ What colour is the text of this element?
    <h2 class="menu" id="hero">Hi</h2>
    CSS:
    h2 { color: green; }
    h2 { color: white; }
    (a) blue (b) white (c) green (d) purple
  15. 15.📱 min-width: 800px applies when the screen is ___. (a) 800px or wider (b) turned off (c) exactly 100px (d) 800px or narrower
  16. 16.🖌️ Where does the text sit on its line?
    h1 {
      font-size: 36px;
      text-align: center;
      color: white;
      background-color: red;
    }
    (a) on the right (b) in the middle (c) on the left
  17. 17.🖌️ Which CSS property picks the font style? (a) color (b) font-family (c) text-align (d) font-size
  18. 18.📦 In the box model, which part is the line round the box? (a) border (b) margin (c) padding (d) content
  19. 19.True or false: JavaScript reacts to a button click. (a) False (b) True
  20. 20.✍️ What value is given to text-align in this rule?
    p {
      font-style: italic;
      text-align: center;
    }
    (a) 10px (b) text-align (c) center (d) yellow
  21. 21.What does font-size do? (a) makes the text bold (b) picks the font style (c) makes letters bigger (d) centres a heading
  22. 22.Which of these does HTML do? (a) checks a quiz answer (b) lays out the page (c) counts down a timer (d) makes a form box
  23. 23.🎨 One CSS file can style how many pages? (a) only one image (b) many pages (c) no pages (d) only one word
  24. 24.🔍 Which is the odd one out? (a) reacts to a button click (b) sets colours and fonts (c) changes the page live (d) shows a pop-up message
  25. 25.🖌️ Which CSS property makes letters bigger? (a) color (b) font-size (c) font-family (d) text-align
  26. 26.✍️ What is the selector in this CSS rule?
    p {
      margin: 10px;
      font-size: 20px;
      color: red;
    }
    (a) p (b) margin (c) 20px (d) .note
  27. 27.🖌️ What colour are the letters?
    h1 {
      text-align: right;
      color: blue;
      background-color: yellow;
      font-size: 12px;
    }
    (a) yellow (b) green (c) blue
  28. 28.🧩 Which language makes a link? (a) JavaScript (b) HTML (c) CSS
  29. 29.🔍 Which is the odd one out? (a) puts a picture on a page (b) shows a pop-up message (c) makes headings and lists (d) makes a link
  30. 30.✍️ Which property is set to 8px in this rule?
    .note {
      border: 2px solid;
      font-size: 20px;
      padding: 8px;
    }
    (a) border (b) padding (c) font-weight (d) 8px
  31. 31.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      color: red;
      width: 300px;
      border: 2px solid;
    }
  32. 32.🌈 Which hex code is red? (a) #ffffff (b) #ffff00 (c) #ff0000 (d) #0000ff
  33. 33.🖌️ Which CSS property centres a heading? (a) background-color (b) font-weight (c) text-align (d) font-size
  34. 34.🔍 Which is the odd one out? (a) makes a link (b) checks a quiz answer (c) makes headings and lists (d) makes a form box
  35. 35.🎯 What kind of selector is .menu? (a) a class selector (b) an element selector (c) an id selector
  36. 36.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 14px;
      }
    }
    (a) Yes (b) No
  37. 37.⚖️ What colour is the text of this element?
    <h1 class="note" id="logo">Hi</h1>
    CSS:
    #logo { color: yellow; }
    h1 { color: green; }
    .note { color: red; }
    (a) white (b) red (c) yellow (d) green
  38. 38.✍️ Which sign ends each CSS declaration? (a) , (b) : (c) . (d) ;
  39. 39.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 160px;
      justify-content: center;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  40. 40.✍️ How many declarations (property: value pairs) are in this rule?
    body {
      font-size: 20px;
    }

Answer key

  1. align-items
  2. style
  3. <style>
  4. fits every screen
  5. 4
  6. equal gaps, none at ends
  7. 138
  8. False
  9. display: flex
  10. makes headings and lists
  11. an element selector
  12. the viewport meta tag
  13. 254
  14. white
  15. 800px or wider
  16. in the middle
  17. font-family
  18. border
  19. True
  20. center
  21. makes letters bigger
  22. makes a form box
  23. many pages
  24. sets colours and fonts
  25. font-size
  26. p
  27. blue
  28. HTML
  29. shows a pop-up message
  30. padding
  31. 3
  32. #ff0000
  33. text-align
  34. checks a quiz answer
  35. a class selector
  36. No
  37. yellow
  38. ;
  39. 20
  40. 1

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