← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 45 · 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 is the odd one out? (a) changes the text size (b) sets colours and fonts (c) rounds box corners (d) counts down a timer
  2. 2.🎨 A CSS file usually ends with which extension? (a) .png (b) .html (c) .css (d) .js
  3. 3.🎯 What kind of selector is body? (a) an element selector (b) an id selector (c) a class selector
  4. 4.🌈 In #rrggbb, which colour do the first two digits give? (a) red (b) black (c) blue (d) green
  5. 5.🎯 Which sign starts a class selector? (a) @ (b) # (c) . (d) &
  6. 6.🧩 Which language rounds box corners? (a) JavaScript (b) HTML (c) CSS
  7. 7.True or false: body is an element selector. (a) True (b) False
  8. 8.💪 Which flexbox property spaces boxes along a row? (a) justify-content (b) gap (c) align-items (d) flex-direction
  9. 9.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the later one (b) neither (c) the first one (d) the shorter one
  10. 10.🌈 Which colour is rgb(255, 0, 255)? (a) white (b) blue (c) magenta (d) black
  11. 11.⚖️ Which selector is the strongest? (a) a class selector (b) an id selector (c) an element selector
  12. 12.🌈 In #710000 the red part is the hex number 71. What is it as a normal number?
  13. 13.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 80px;
      padding: 15px;
      border: 1px solid black;
      margin: 10px;
    }
  14. 14.🧩 Which language gives the page structure? (a) JavaScript (b) CSS (c) HTML
  15. 15.⚖️ What colour is the text of this element?
    <p class="note" id="intro">Hi</p>
    CSS:
    .note { color: green; }
    #intro { color: black; }
    (a) red (b) blue (c) green (d) black
  16. 16.🖌️ What colour is behind the letters?
    li {
      text-align: center;
      background-color: yellow;
      font-size: 24px;
      color: blue;
    }
    (a) blue (b) yellow (c) black
  17. 17.Which of these is padding? (a) a solid or dotted edge (b) space outside the border (c) the text or picture (d) space inside the border
  18. 18.💪 Which flexbox property sets space between boxes? (a) justify-content (b) display: flex (c) flex-direction (d) gap
  19. 19.🌈 In #000065 the blue part is the hex number 65. What is it as a normal number?
  20. 20.📱 Which tag helps phones show a page at the right size? (a) the hr tag (b) the br tag (c) the viewport meta tag (d) the title tag
  21. 21.✍️ CSS declarations go inside which brackets? (a) ( ) (b) { } (c) [ ] (d) < >
  22. 22.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 16px;
      }
    }
  23. 23.✍️ What is the selector in this CSS rule?
    h1 {
      font-size: 20px;
      color: red;
    }
    (a) font-size (b) p (c) h1 (d) red
  24. 24.✍️ In color: blue; which part is the property? (a) blue (b) : (c) ; (d) color
  25. 25.📱 What does a media query check? (a) the battery level (b) the screen width (c) the page title (d) the time of day
  26. 26.✍️ Which sign goes between a property and its value? (a) : (b) = (c) - (d) ;
  27. 27.✍️ How many declarations (property: value pairs) are in this rule?
    .box {
      font-weight: bold;
      color: red;
    }
  28. 28.True or false: JavaScript changes the page live. (a) True (b) False
  29. 29.💪 Which justify-content value equal gaps, none at ends? (a) space-between (b) flex-start (c) center (d) flex-end
  30. 30.🎨 One CSS file can style how many pages? (a) only one word (b) only one image (c) no pages (d) many pages
  31. 31.🌈 Which colour is #00ff00? (a) magenta (b) bright green (c) red (d) black
  32. 32.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 18px;
      }
    }
  33. 33.🖌️ What colour are the letters?
    h2 {
      font-size: 40px;
      color: white;
      text-align: right;
      background-color: green;
    }
    (a) white (b) green (c) red
  34. 34.Which of these does CSS do? (a) changes the text size (b) reacts to a button click (c) makes a link (d) puts a picture on a page
  35. 35.🎨 Which tag holds CSS inside the head? (a) <css> (b) <script> (c) <body> (d) <style>
  36. 36.✍️ What is the selector in this CSS rule?
    .note {
      text-align: center;
      font-style: italic;
      width: 300px;
    }
    (a) italic (b) text-align (c) .note (d) #top
  37. 37.🌈 Hex digits go 0 to 9, then A to which letter? (a) F (b) Z (c) G (d) J
  38. 38.🎨 Which tag connects an outside CSS file? (a) <link> (b) <img> (c) <a> (d) <css>
  39. 39.✍️ What value is given to width in this rule?
    h1 {
      text-align: center;
      width: 300px;
    }
    (a) red (b) 300px (c) width (d) italic
  40. 40.🖌️ Which CSS property picks the font style? (a) font-family (b) text-align (c) color (d) font-size

Answer key

  1. counts down a timer
  2. .css
  3. an element selector
  4. red
  5. .
  6. CSS
  7. True
  8. justify-content
  9. the later one
  10. magenta
  11. an id selector
  12. 113
  13. 132
  14. HTML
  15. black
  16. yellow
  17. space inside the border
  18. gap
  19. 101
  20. the viewport meta tag
  21. { }
  22. 12
  23. h1
  24. color
  25. the screen width
  26. :
  27. 2
  28. True
  29. space-between
  30. many pages
  31. bright green
  32. 18
  33. white
  34. changes the text size
  35. <style>
  36. .note
  37. F
  38. <link>
  39. 300px
  40. font-family

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