← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 504 · 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.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      font-weight: bold;
    }
  2. 2.🔍 Which is the odd one out? (a) makes a form box (b) gives the page structure (c) makes a link (d) adds space around boxes
  3. 3.True or false: padding is the gap round content. (a) True (b) False
  4. 4.🖌️ Which CSS property centres a heading? (a) color (b) background-color (c) font-family (d) text-align
  5. 5.🌈 Which colour is #ffffff? (a) bright green (b) black (c) yellow (d) white
  6. 6.🎯 Which CSS selector matches this element?
    <li class="red" id="end">Hello</li>
    (a) div (b) .end (c) .red (d) .box
  7. 7.🌈 Which colour of light is strongest in rgb(176, 129, 105)? (a) red (b) green (c) blue
  8. 8.✍️ How does a CSS comment start? (a) # (b) /* (c) <!-- (d) //
  9. 9.🌈 Which colour of light is strongest in rgb(234, 9, 15)? (a) green (b) red (c) blue
  10. 10.✍️ Which property is set to red in this rule?
    h2 {
      width: 300px;
      color: red;
    }
    (a) text-align (b) font-size (c) red (d) color
  11. 11.🎨 Which tag connects an outside CSS file? (a) <css> (b) <img> (c) <link> (d) <a>
  12. 12.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 120px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  13. 13.🎨 One CSS file can style how many pages? (a) only one image (b) no pages (c) many pages (d) only one word
  14. 14.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 26px;
      }
    }
  15. 15.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 18px;
      }
    }
  16. 16.🎯 How many elements on a page should have the same id? (a) 1 (b) 5 (c) 2 (d) any number
  17. 17.🖌️ What colour is behind the letters?
    h2 {
      text-align: left;
      font-size: 36px;
      color: purple;
      background-color: green;
    }
    (a) green (b) purple (c) yellow
  18. 18.🖌️ What colour are the letters?
    p {
      text-align: center;
      background-color: white;
      font-size: 12px;
      color: black;
    }
    (a) black (b) yellow (c) white
  19. 19.✍️ What value is given to font-style in this rule?
    h2 {
      font-style: italic;
      background-color: yellow;
    }
    (a) 20px (b) red (c) font-style (d) italic
  20. 20.📦 In the box model, which part is space outside the border? (a) border (b) margin (c) padding (d) content
  21. 21.✍️ In color: blue; which part is the property? (a) color (b) blue (c) : (d) ;
  22. 22.✍️ Which sign ends each CSS declaration? (a) : (b) . (c) ; (d) ,
  23. 23.🌈 Which colour is rgb(255, 0, 255)? (a) red (b) yellow (c) magenta (d) cyan
  24. 24.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 280px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  25. 25.⚖️ What colour is the text of this element?
    <p class="box" id="top">Hi</p>
    CSS:
    p { color: green; }
    .box { color: red; }
    #top { color: orange; }
    (a) green (b) white (c) red (d) orange
  26. 26.🌈 Which colour is #000000? (a) blue (b) bright green (c) black (d) red
  27. 27.🎨 What does CSS stand for? (a) Colourful Site Styles (b) Cascading Style Sheets (c) Computer Style Sheets (d) Creative Sheet System
  28. 28.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 70px;
      padding: 20px;
      border: 4px solid black;
      margin: 10px;
    }
  29. 29.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 100px;
      padding: 10px;
      border: 1px solid black;
      margin: 5px;
    }
  30. 30.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 120px;
      justify-content: center;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  31. 31.🎯 Which CSS selector matches this element?
    <h2 class="big" id="logo">Hello</h2>
    (a) li (b) .logo (c) #logo (d) #big
  32. 32.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 150px;
      padding: 20px;
      border: 2px solid black;
      margin: 20px;
    }
  33. 33.🌈 Which hex code is bright green? (a) #00ff00 (b) #ffff00 (c) #ff00ff (d) #ffffff
  34. 34.What does color do? (a) picks the font style (b) makes letters bigger (c) sets the letter colour (d) centres a heading
  35. 35.Which of these does HTML do? (a) changes the page live (b) gives the page structure (c) rounds box corners (d) counts down a timer
  36. 36.✍️ What is the selector in this CSS rule?
    .note {
      border: 2px solid;
      width: 300px;
      background-color: yellow;
      color: red;
    }
    (a) border (b) #top (c) .note (d) 300px
  37. 37.⚖️ What colour is the text of this element?
    <p class="menu" id="intro">Hi</p>
    CSS:
    .menu { color: black; }
    p { color: red; }
    (a) purple (b) blue (c) red (d) black
  38. 38.⚖️ What colour is the text of this element?
    <p class="big" id="logo">Hi</p>
    CSS:
    .big { color: orange; }
    .big { color: blue; }
    (a) orange (b) white (c) blue (d) purple
  39. 39.🌈 In #270000 the red part is the hex number 27. What is it as a normal number?
  40. 40.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 6 (b) 2 (c) 4 (d) 3

Answer key

  1. 1
  2. adds space around boxes
  3. True
  4. text-align
  5. white
  6. .red
  7. red
  8. /*
  9. red
  10. color
  11. <link>
  12. 20
  13. many pages
  14. 26
  15. 24
  16. 1
  17. green
  18. black
  19. italic
  20. margin
  21. color
  22. ;
  23. magenta
  24. 80
  25. orange
  26. black
  27. Cascading Style Sheets
  28. 138
  29. 132
  30. 10
  31. #logo
  32. 194
  33. #00ff00
  34. sets the letter colour
  35. gives the page structure
  36. .note
  37. black
  38. blue
  39. 39
  40. 3

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