← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 317 · 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 #00ffff? (a) black (b) bright green (c) cyan (d) blue
  2. 2.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 20px;
      }
    }
  3. 3.🎨 What does CSS stand for? (a) Computer Style Sheets (b) Colourful Site Styles (c) Cascading Style Sheets (d) Creative Sheet System
  4. 4.💪 Which flexbox property turns on flexbox? (a) gap (b) display: flex (c) justify-content (d) align-items
  5. 5.🌈 Which colour is rgb(255, 255, 255)? (a) cyan (b) white (c) black (d) blue
  6. 6.⚖️ What colour is the text of this element?
    <p class="box" id="hero">Hi</p>
    CSS:
    p { color: orange; }
    #hero { color: black; }
    (a) purple (b) blue (c) black (d) orange
  7. 7.💪 Which flexbox property lines boxes up across? (a) display: flex (b) justify-content (c) align-items (d) flex-direction
  8. 8.🎯 What kind of selector is img? (a) a class selector (b) an element selector (c) an id selector
  9. 9.⚖️ What colour is the text of this element?
    <h1 class="star" id="intro">Hi</h1>
    CSS:
    h1 { color: black; }
    .star { color: green; }
    #intro { color: blue; }
    (a) white (b) black (c) green (d) blue
  10. 10.🎨 One CSS file can style how many pages? (a) only one word (b) many pages (c) only one image (d) no pages
  11. 11.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 150px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  12. 12.✍️ What value is given to margin in this rule?
    .box {
      color: red;
      margin: 10px;
      padding: 8px;
    }
    (a) margin (b) 10px (c) 8px (d) bold
  13. 13.🌈 What is the biggest number one colour can have in rgb()? (a) 100 (b) 255 (c) 1000 (d) 99
  14. 14.🧩 Which language makes a link? (a) HTML (b) JavaScript (c) CSS
  15. 15.True or false: #hero is an id selector. (a) True (b) False
  16. 16.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      text-align: center;
      font-size: 20px;
      font-style: italic;
      border: 2px solid;
    }
  17. 17.📦 In the box model, which part is a solid or dotted edge? (a) padding (b) border (c) content (d) margin
  18. 18.📱 Responsive design means a page ___. (a) has no pictures (b) never changes (c) fits every screen (d) is only for laptops
  19. 19.🔍 Which is the odd one out? (a) shows a pop-up message (b) makes a link (c) makes headings and lists (d) makes a form box
  20. 20.True or false: padding is the line round the box. (a) False (b) True
  21. 21.💪 Which justify-content value equal gaps, none at ends? (a) center (b) flex-start (c) flex-end (d) space-between
  22. 22.⚖️ What colour is the text of this element?
    <h1 class="big" id="top">Hi</h1>
    CSS:
    #top { color: black; }
    #top { color: blue; }
    (a) green (b) purple (c) black (d) blue
  23. 23.🖌️ How big is the text, in px?
    h1 {
      color: blue;
      background-color: green;
      text-align: right;
      font-size: 12px;
    }
  24. 24.⚖️ Which selector is the strongest? (a) a class selector (b) an element selector (c) an id selector
  25. 25.✍️ In color: blue; which part is the value? (a) ; (b) color (c) blue (d) :
  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: 300px;
      padding: 5px;
      border: 2px solid black;
      margin: 5px;
    }
  27. 27.True or false: margin is space inside the border. (a) False (b) True
  28. 28.True or false: JavaScript makes headings and lists. (a) False (b) True
  29. 29.⚖️ What colour is the text of this element?
    <h2 class="big" id="logo">Hi</h2>
    CSS:
    h2 { color: red; }
    #logo { color: white; }
    (a) red (b) blue (c) white (d) purple
  30. 30.⚖️ Which selector is the weakest? (a) an id selector (b) a class selector (c) an element selector
  31. 31.🎯 Which element does the selector h1 style? (a) <li class="star"> (b) <h2> (c) <div id="top"> (d) <h1 class="star">
  32. 32.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 28px;
      }
    }
  33. 33.🌈 Which colour is rgb(255, 0, 255)? (a) cyan (b) magenta (c) black (d) white
  34. 34.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 130px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  35. 35.What does font-family do? (a) makes letters bigger (b) sets the letter colour (c) centres a heading (d) picks the font style
  36. 36.Which of these does HTML do? (a) sets colours and fonts (b) changes the text size (c) counts down a timer (d) gives the page structure
  37. 37.💪 Which flexbox property spaces boxes along a row? (a) gap (b) flex-direction (c) align-items (d) justify-content
  38. 38.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 26px;
      }
    }
  39. 39.🖌️ Where does the text sit on its line?
    h2 {
      font-size: 16px;
      background-color: purple;
      text-align: right;
      color: orange;
    }
    (a) on the left (b) in the middle (c) on the right
  40. 40.📦 In the box model, which part is the gap round content? (a) padding (b) border (c) content (d) margin

Answer key

  1. cyan
  2. 24
  3. Cascading Style Sheets
  4. display: flex
  5. white
  6. black
  7. align-items
  8. an element selector
  9. blue
  10. many pages
  11. 50
  12. 10px
  13. 255
  14. HTML
  15. True
  16. 4
  17. border
  18. fits every screen
  19. shows a pop-up message
  20. False
  21. space-between
  22. blue
  23. 12
  24. an id selector
  25. blue
  26. 314
  27. False
  28. False
  29. white
  30. an element selector
  31. <h1 class="star">
  32. 20
  33. magenta
  34. 30
  35. picks the font style
  36. gives the page structure
  37. justify-content
  38. 24
  39. on the right
  40. padding

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