← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 564 · 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 much space across (px) does this box take in all, margin included?
    .box {
      width: 130px;
      padding: 25px;
      border: 4px solid black;
      margin: 20px;
    }
  2. 2.🌈 In #000045 the blue part is the hex number 45. What is it as a normal number?
  3. 3.🖌️ How big is the text, in px?
    h2 {
      text-align: center;
      font-size: 32px;
      background-color: green;
      color: blue;
    }
  4. 4.🎯 What kind of selector is .star? (a) an element selector (b) an id selector (c) a class selector
  5. 5.💪 Which flexbox property spaces boxes along a row? (a) justify-content (b) display: flex (c) align-items (d) flex-direction
  6. 6.Which of these does CSS do? (a) gives the page structure (b) reacts to a button click (c) changes the text size (d) changes the page live
  7. 7.📦 In the box model, which part is the text or picture? (a) border (b) content (c) margin (d) padding
  8. 8.True or false: the content is space inside the border. (a) True (b) False
  9. 9.🎯 Which element does the selector #main style? (a) <p class="box"> (b) <span id="logo"> (c) <span class="main"> (d) <span id="main">
  10. 10.🖌️ What colour is behind the letters?
    h1 {
      text-align: right;
      color: red;
      background-color: black;
      font-size: 16px;
    }
    (a) red (b) black (c) orange
  11. 11.🎯 What kind of selector is #logo? (a) an element selector (b) a class selector (c) an id selector
  12. 12.🖌️ What colour are the letters?
    h2 {
      text-align: left;
      font-size: 20px;
      color: red;
      background-color: yellow;
    }
    (a) yellow (b) red (c) black
  13. 13.True or false: padding is the gap round content. (a) True (b) False
  14. 14.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 10px;
      }
    }
    (a) No (b) Yes
  15. 15.🌈 In #300000 the red part is the hex number 30. What is it as a normal number?
  16. 16.🌈 Which colour is #0000ff? (a) black (b) blue (c) red (d) yellow
  17. 17.✍️ How does a CSS comment start? (a) # (b) <!-- (c) // (d) /*
  18. 18.🌈 In #790000 the red part is the hex number 79. What is it as a normal number?
  19. 19.What does background-color do? (a) picks the font style (b) makes the text bold (c) sets the letter colour (d) colours behind the text
  20. 20.What does font-size do? (a) colours behind the text (b) sets the letter colour (c) makes the text bold (d) makes letters bigger
  21. 21.✍️ What is the selector in this CSS rule?
    #top {
      font-style: italic;
      font-weight: bold;
      text-align: center;
      width: 300px;
    }
    (a) li (b) bold (c) font-style (d) #top
  22. 22.⚖️ What colour is the text of this element?
    <h2 class="red" id="intro">Hi</h2>
    CSS:
    h2 { color: green; }
    .red { color: orange; }
    #intro { color: red; }
    (a) orange (b) green (c) red (d) white
  23. 23.✍️ Which sign ends each CSS declaration? (a) . (b) , (c) ; (d) :
  24. 24.🎯 Which CSS selector matches this element?
    <span class="menu" id="main">Hello</span>
    (a) #logo (b) p (c) #main (d) .main
  25. 25.What does font-family do? (a) makes letters bigger (b) centres a heading (c) makes the text bold (d) picks the font style
  26. 26.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 120px;
      justify-content: center;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  27. 27.True or false: CSS sets colours and fonts. (a) True (b) False
  28. 28.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 380px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 80px wide (no margins).
  29. 29.🎯 What kind of selector is .note? (a) a class selector (b) an element selector (c) an id selector
  30. 30.🎨 What does CSS stand for? (a) Colourful Site Styles (b) Creative Sheet System (c) Computer Style Sheets (d) Cascading Style Sheets
  31. 31.🌈 Which colour is #00ff00? (a) red (b) bright green (c) black (d) magenta
  32. 32.🌈 What is the biggest number one colour can have in rgb()? (a) 99 (b) 255 (c) 1000 (d) 100
  33. 33.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 10px;
      }
    }
  34. 34.🎯 What kind of selector is .menu? (a) an element selector (b) a class selector (c) an id selector
  35. 35.Which of these does CSS do? (a) makes a link (b) makes headings and lists (c) lays out the page (d) makes a form box
  36. 36.📱 max-width: 600px applies when the screen is ___. (a) exactly 1000px (b) turned off (c) 600px or wider (d) 600px or narrower
  37. 37.🌈 Which colour is #000000? (a) cyan (b) bright green (c) blue (d) black
  38. 38.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 70px;
      padding: 25px;
      border: 1px solid black;
      margin: 15px;
    }
  39. 39.🎨 One CSS file can style how many pages? (a) only one word (b) only one image (c) no pages (d) many pages
  40. 40.🎯 Which CSS selector matches this element?
    <h1 class="red" id="main">Hello</h1>
    (a) .red (b) .box (c) .main (d) #logo

Answer key

  1. 228
  2. 69
  3. 32
  4. a class selector
  5. justify-content
  6. changes the text size
  7. content
  8. False
  9. <span id="main">
  10. black
  11. an id selector
  12. red
  13. True
  14. No
  15. 48
  16. blue
  17. /*
  18. 121
  19. colours behind the text
  20. makes letters bigger
  21. #top
  22. red
  23. ;
  24. #main
  25. picks the font style
  26. 20
  27. True
  28. 20
  29. a class selector
  30. Cascading Style Sheets
  31. bright green
  32. 255
  33. 10
  34. a class selector
  35. lays out the page
  36. 600px or narrower
  37. black
  38. 152
  39. many pages
  40. .red

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