← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 779 · 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 colour is #000000? (a) magenta (b) blue (c) black (d) bright green
  2. 2.🎯 What kind of selector is p? (a) a class selector (b) an id selector (c) an element selector
  3. 3.🖌️ Which CSS property sets the letter colour? (a) color (b) font-family (c) text-align (d) background-color
  4. 4.🧩 Which language makes headings and lists? (a) CSS (b) JavaScript (c) HTML
  5. 5.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 200px;
      padding: 20px;
      border: 1px solid black;
      margin: 5px;
    }
  6. 6.True or false: the border is the line round the box. (a) False (b) True
  7. 7.True or false: the content is a solid or dotted edge. (a) True (b) False
  8. 8.🧩 Which language rounds box corners? (a) CSS (b) JavaScript (c) HTML
  9. 9.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the later one (b) the first one (c) the shorter one (d) neither
  10. 10.✍️ CSS declarations go inside which brackets? (a) { } (b) ( ) (c) [ ] (d) < >
  11. 11.⚖️ What colour is the text of this element?
    <h1 class="red" id="logo">Hi</h1>
    CSS:
    h1 { color: green; }
    #logo { color: white; }
    .red { color: red; }
    (a) red (b) green (c) yellow (d) white
  12. 12.🎯 Which element does the selector li style? (a) <p id="intro"> (b) <li class="box"> (c) <span class="box"> (d) <div>
  13. 13.True or false: li is an element selector. (a) True (b) False
  14. 14.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 340px;
      justify-content: center;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  15. 15.🎯 What kind of selector is .menu? (a) an id selector (b) a class selector (c) an element selector
  16. 16.🖌️ What colour are the letters?
    li {
      text-align: center;
      background-color: red;
      font-size: 28px;
      color: green;
    }
    (a) green (b) red (c) orange
  17. 17.What does justify-content: flex-start do? (a) equal gaps, none at ends (b) packs boxes at the end (c) packs boxes at the start (d) puts boxes in the middle
  18. 18.⚖️ Which selector is the weakest? (a) an element selector (b) a class selector (c) an id selector
  19. 19.✍️ Which sign goes between a property and its value? (a) ; (b) : (c) - (d) =
  20. 20.🖌️ Which CSS property makes letters bigger? (a) color (b) text-align (c) font-family (d) font-size
  21. 21.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 10px;
      }
    }
  22. 22.📦 In the box model, which part is the line round the box? (a) margin (b) border (c) padding (d) content
  23. 23.✍️ What is the selector in this CSS rule?
    body {
      margin: 10px;
      text-align: center;
    }
    (a) .box (b) center (c) margin (d) body
  24. 24.⚖️ What colour is the text of this element?
    <p class="red" id="top">Hi</p>
    CSS:
    p { color: yellow; }
    .red { color: orange; }
    (a) yellow (b) orange (c) black (d) white
  25. 25.🌈 In #00e700 the green part is the hex number e7. What is it as a normal number?
  26. 26.Which of these does HTML do? (a) shows a pop-up message (b) gives the page structure (c) adds space around boxes (d) sets colours and fonts
  27. 27.🎨 Which tag connects an outside CSS file? (a) <img> (b) <a> (c) <css> (d) <link>
  28. 28.What does background-color do? (a) sets the letter colour (b) makes letters bigger (c) colours behind the text (d) centres a heading
  29. 29.✍️ What is the selector in this CSS rule?
    body {
      font-size: 20px;
      background-color: yellow;
      font-style: italic;
    }
    (a) body (b) yellow (c) font-size (d) .box
  30. 30.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 18px;
      }
    }
    (a) No (b) Yes
  31. 31.🌈 What is the biggest number one colour can have in rgb()? (a) 100 (b) 99 (c) 255 (d) 1000
  32. 32.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 4 (b) 2 (c) 3 (d) 6
  33. 33.Which of these does JavaScript do? (a) makes headings and lists (b) reacts to a button click (c) puts a picture on a page (d) sets colours and fonts
  34. 34.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 200px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  35. 35.📱 The screen is 820px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 30px;
      }
    }
    (a) Yes (b) No
  36. 36.🖌️ Which CSS property picks the font style? (a) font-weight (b) color (c) font-family (d) font-size
  37. 37.🌈 In #0000a8 the blue part is the hex number a8. What is it as a normal number?
  38. 38.🎯 What kind of selector is .note? (a) a class selector (b) an id selector (c) an element selector
  39. 39.🌈 Which colour of light is strongest in rgb(81, 70, 251)? (a) red (b) green (c) blue
  40. 40.📱 What does a media query check? (a) the battery level (b) the page title (c) the time of day (d) the screen width

Answer key

  1. black
  2. an element selector
  3. color
  4. HTML
  5. 252
  6. True
  7. False
  8. CSS
  9. the later one
  10. { }
  11. white
  12. <li class="box">
  13. True
  14. 70
  15. a class selector
  16. green
  17. packs boxes at the start
  18. an element selector
  19. :
  20. font-size
  21. 10
  22. border
  23. body
  24. orange
  25. 231
  26. gives the page structure
  27. <link>
  28. colours behind the text
  29. body
  30. Yes
  31. 255
  32. 3
  33. reacts to a button click
  34. 80
  35. Yes
  36. font-family
  37. 168
  38. a class selector
  39. blue
  40. the screen width

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