← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 433 · 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.✍️ What is the selector in this CSS rule?
    h2 {
      font-weight: bold;
      background-color: yellow;
      color: red;
    }
    (a) h1 (b) font-weight (c) h2 (d) yellow
  2. 2.🖌️ What colour are the letters?
    h2 {
      text-align: right;
      color: black;
      font-size: 36px;
      background-color: white;
    }
    (a) black (b) white (c) yellow
  3. 3.🧩 Which language checks a quiz answer? (a) JavaScript (b) CSS (c) HTML
  4. 4.🌈 Which colour is #ffff00? (a) cyan (b) white (c) yellow (d) blue
  5. 5.Which of these does HTML do? (a) sets colours and fonts (b) changes the page live (c) makes a form box (d) lays out the page
  6. 6.✍️ Which sign goes between a property and its value? (a) - (b) = (c) : (d) ;
  7. 7.Which of these is padding? (a) a solid or dotted edge (b) the line round the box (c) space inside the border (d) space outside the border
  8. 8.🎯 Which element does the selector div style? (a) <span> (b) <h1 id="main"> (c) <p class="red"> (d) <div class="red">
  9. 9.What does font-family do? (a) sets the letter colour (b) picks the font style (c) makes the text bold (d) centres a heading
  10. 10.🎯 Which element does the selector .menu style? (a) <span class="menu"> (b) <span class="note"> (c) <p class="big"> (d) <span id="menu">
  11. 11.🖌️ Which CSS property sets the letter colour? (a) font-size (b) font-weight (c) color (d) font-family
  12. 12.🌈 In #00f200 the green part is the hex number f2. What is it as a normal number?
  13. 13.🖌️ What colour are the letters?
    p {
      font-size: 12px;
      text-align: center;
      color: red;
      background-color: purple;
    }
    (a) purple (b) red (c) blue
  14. 14.Which of these is the content? (a) the text or picture (b) a solid or dotted edge (c) space outside the border (d) the gap round content
  15. 15.⚖️ Which selector is the strongest? (a) an id selector (b) a class selector (c) an element selector
  16. 16.✍️ How does a CSS comment start? (a) # (b) <!-- (c) /* (d) //
  17. 17.💪 Which flexbox property turns on flexbox? (a) flex-direction (b) justify-content (c) display: flex (d) align-items
  18. 18.🎯 How many elements on a page should have the same id? (a) any number (b) 1 (c) 2 (d) 5
  19. 19.True or false: HTML shows a pop-up message. (a) True (b) False
  20. 20.🌈 Which hex code is white? (a) #ff00ff (b) #ffffff (c) #00ffff (d) #ff0000
  21. 21.⚖️ What colour is the text of this element?
    <h2 class="red" id="intro">Hi</h2>
    CSS:
    #intro { color: yellow; }
    .red { color: green; }
    (a) green (b) yellow (c) black (d) purple
  22. 22.🌈 Which colour is rgb(0, 255, 255)? (a) white (b) black (c) cyan (d) blue
  23. 23.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 30px;
      }
    }
  24. 24.⚖️ What colour is the text of this element?
    <h1 class="red" id="end">Hi</h1>
    CSS:
    #end { color: white; }
    #end { color: purple; }
    (a) purple (b) red (c) yellow (d) white
  25. 25.🎯 Which CSS selector matches this element?
    <span class="star" id="intro">Hello</span>
    (a) #star (b) .menu (c) span (d) .intro
  26. 26.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 70px;
      padding: 5px;
      border: 4px solid black;
      margin: 5px;
    }
  27. 27.📱 What does a media query check? (a) the time of day (b) the page title (c) the screen width (d) the battery level
  28. 28.⚖️ What colour is the text of this element?
    <h1 class="menu" id="intro">Hi</h1>
    CSS:
    .menu { color: red; }
    .menu { color: blue; }
    (a) orange (b) blue (c) red (d) yellow
  29. 29.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 180px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  30. 30.🌈 Which hex code is yellow? (a) #ff00ff (b) #ffff00 (c) #0000ff (d) #ff0000
  31. 31.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the first one (b) the shorter one (c) neither (d) the later one
  32. 32.🌈 What is the biggest number one colour can have in rgb()? (a) 100 (b) 255 (c) 1000 (d) 99
  33. 33.🔍 Which is the odd one out? (a) makes headings and lists (b) puts a picture on a page (c) makes a link (d) adds space around boxes
  34. 34.🧩 Which language makes a form box? (a) JavaScript (b) CSS (c) HTML
  35. 35.True or false: margin is space outside the border. (a) True (b) False
  36. 36.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 6 (b) 2 (c) 3 (d) 4
  37. 37.🌈 In #9e0000 the red part is the hex number 9e. What is it as a normal number?
  38. 38.📦 In the box model, which part is space outside the border? (a) content (b) border (c) padding (d) margin
  39. 39.🖌️ How big is the text, in px?
    li {
      text-align: right;
      background-color: orange;
      font-size: 32px;
      color: white;
    }
  40. 40.🌈 Which colour is #00ff00? (a) cyan (b) blue (c) white (d) bright green

Answer key

  1. h2
  2. black
  3. JavaScript
  4. yellow
  5. makes a form box
  6. :
  7. space inside the border
  8. <div class="red">
  9. picks the font style
  10. <span class="menu">
  11. color
  12. 242
  13. red
  14. the text or picture
  15. an id selector
  16. /*
  17. display: flex
  18. 1
  19. False
  20. #ffffff
  21. yellow
  22. cyan
  23. 30
  24. purple
  25. span
  26. 88
  27. the screen width
  28. blue
  29. 80
  30. #ffff00
  31. the later one
  32. 255
  33. adds space around boxes
  34. HTML
  35. True
  36. 3
  37. 158
  38. margin
  39. 32
  40. bright green

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