← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 377 · 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 property is set to yellow in this rule?
    p {
      background-color: yellow;
      padding: 8px;
      font-size: 20px;
    }
    (a) margin (b) padding (c) yellow (d) background-color
  2. 2.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 270px;
      padding: 25px;
      border: 5px solid black;
      margin: 15px;
    }
  3. 3.✍️ What value is given to font-weight in this rule?
    li {
      width: 300px;
      font-weight: bold;
    }
    (a) bold (b) 300px (c) 2px solid (d) font-weight
  4. 4.🎯 Which sign starts a class selector? (a) & (b) @ (c) . (d) #
  5. 5.🧩 Which language checks a quiz answer? (a) HTML (b) JavaScript (c) CSS
  6. 6.🌈 Which colour is rgb(255, 255, 0)? (a) magenta (b) white (c) yellow (d) blue
  7. 7.📱 What does a media query check? (a) the page title (b) the time of day (c) the battery level (d) the screen width
  8. 8.✍️ Which sign ends each CSS declaration? (a) . (b) : (c) ; (d) ,
  9. 9.🔍 Which is the odd one out? (a) checks a quiz answer (b) makes a form box (c) puts a picture on a page (d) makes a link
  10. 10.Which of these does JavaScript do? (a) changes the text size (b) changes the page live (c) makes a form box (d) lays out the page
  11. 11.⚖️ What colour is the text of this element?
    <h1 class="menu" id="end">Hi</h1>
    CSS:
    .menu { color: green; }
    .menu { color: white; }
    (a) orange (b) white (c) green (d) yellow
  12. 12.💪 Which justify-content value packs boxes at the start? (a) center (b) space-between (c) flex-end (d) flex-start
  13. 13.True or false: the border is a solid or dotted edge. (a) True (b) False
  14. 14.Which of these does JavaScript do? (a) makes a link (b) checks a quiz answer (c) makes headings and lists (d) gives the page structure
  15. 15.⚖️ What colour is the text of this element?
    <h1 class="red" id="hero">Hi</h1>
    CSS:
    .red { color: red; }
    .red { color: green; }
    (a) yellow (b) red (c) green (d) orange
  16. 16.🌈 In #00c200 the green part is the hex number c2. What is it as a normal number?
  17. 17.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 90px;
      padding: 30px;
      border: 2px solid black;
      margin: 10px;
    }
  18. 18.⚖️ What colour is the text of this element?
    <h1 class="big" id="intro">Hi</h1>
    CSS:
    h1 { color: white; }
    h1 { color: green; }
    (a) green (b) blue (c) black (d) white
  19. 19.🖌️ What colour is behind the letters?
    p {
      text-align: left;
      color: black;
      background-color: orange;
      font-size: 12px;
    }
    (a) black (b) green (c) orange
  20. 20.🎯 Which element does the selector p style? (a) <p class="note"> (b) <h1> (c) <li id="hero"> (d) <h2 class="note">
  21. 21.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      font-size: 20px;
      text-align: center;
    }
  22. 22.✍️ What is the selector in this CSS rule?
    .box {
      font-style: italic;
      border: 2px solid;
      background-color: yellow;
    }
    (a) 2px solid (b) font-style (c) h2 (d) .box
  23. 23.✍️ How many declarations (property: value pairs) are in this rule?
    body {
      color: red;
      border: 2px solid;
      width: 300px;
      padding: 8px;
    }
  24. 24.🎯 Which element does the selector .star style? (a) <h2 class="note"> (b) <h1 class="star"> (c) <h1 class="menu"> (d) <h1 id="star">
  25. 25.🖌️ What colour are the letters?
    h1 {
      font-size: 32px;
      background-color: purple;
      text-align: right;
      color: red;
    }
    (a) green (b) red (c) purple
  26. 26.🎯 Can many elements share the same class? (a) Yes (b) No
  27. 27.💪 Which flexbox property sets space between boxes? (a) flex-direction (b) justify-content (c) align-items (d) gap
  28. 28.🎨 One CSS file can style how many pages? (a) only one word (b) many pages (c) no pages (d) only one image
  29. 29.⚖️ Which selector is the strongest? (a) a class selector (b) an id selector (c) an element selector
  30. 30.Which of these does CSS do? (a) lays out the page (b) checks a quiz answer (c) shows a pop-up message (d) makes headings and lists
  31. 31.🧩 Which language makes a form box? (a) JavaScript (b) CSS (c) HTML
  32. 32.✍️ Which property is set to 10px in this rule?
    p {
      margin: 10px;
      text-align: center;
    }
    (a) padding (b) 10px (c) font-weight (d) margin
  33. 33.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 6 (b) 4 (c) 2 (d) 3
  34. 34.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 32px;
      }
    }
  35. 35.What does color do? (a) sets the letter colour (b) centres a heading (c) picks the font style (d) colours behind the text
  36. 36.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 8px;
      }
    }
    (a) No (b) Yes
  37. 37.True or false: #main is an element selector. (a) False (b) True
  38. 38.🖌️ Which CSS property makes the text bold? (a) font-size (b) color (c) font-family (d) font-weight
  39. 39.🌈 Which colour is #ffff00? (a) yellow (b) bright green (c) white (d) red
  40. 40.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 18px;
      }
    }
    (a) Yes (b) No

Answer key

  1. background-color
  2. 360
  3. bold
  4. .
  5. JavaScript
  6. yellow
  7. the screen width
  8. ;
  9. checks a quiz answer
  10. changes the page live
  11. white
  12. flex-start
  13. True
  14. checks a quiz answer
  15. green
  16. 194
  17. 174
  18. green
  19. orange
  20. <p class="note">
  21. 2
  22. .box
  23. 4
  24. <h1 class="star">
  25. red
  26. Yes
  27. gap
  28. many pages
  29. an id selector
  30. lays out the page
  31. HTML
  32. margin
  33. 3
  34. 24
  35. sets the letter colour
  36. Yes
  37. False
  38. font-weight
  39. yellow
  40. Yes

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