← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 652 · 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 is the odd one out? (a) reacts to a button click (b) rounds box corners (c) counts down a timer (d) checks a quiz answer
  2. 2.🌈 Which colour is #ffff00? (a) bright green (b) blue (c) white (d) yellow
  3. 3.🎯 Which sign starts a class selector? (a) & (b) @ (c) # (d) .
  4. 4.🎯 Which element does the selector .big style? (a) <h1 class="red"> (b) <h1 id="big"> (c) <h2 class="box"> (d) <h1 class="big">
  5. 5.⚖️ What colour is the text of this element?
    <h2 class="big" id="intro">Hi</h2>
    CSS:
    h2 { color: green; }
    h2 { color: purple; }
    (a) purple (b) orange (c) black (d) green
  6. 6.⚖️ What colour is the text of this element?
    <p class="big" id="end">Hi</p>
    CSS:
    .big { color: yellow; }
    .big { color: white; }
    (a) yellow (b) red (c) white (d) blue
  7. 7.🧩 Which language changes the text size? (a) CSS (b) JavaScript (c) HTML
  8. 8.⚖️ What colour is the text of this element?
    <p class="menu" id="hero">Hi</p>
    CSS:
    .menu { color: green; }
    p { color: white; }
    (a) red (b) white (c) green (d) purple
  9. 9.📱 Which tag helps phones show a page at the right size? (a) the br tag (b) the hr tag (c) the viewport meta tag (d) the title tag
  10. 10.🎯 Which CSS selector matches this element?
    <h2 class="menu" id="intro">Hello</h2>
    (a) #menu (b) #intro (c) .intro (d) li
  11. 11.🖌️ Which CSS property colours behind the text? (a) background-color (b) font-weight (c) font-family (d) color
  12. 12.Which of these does CSS do? (a) puts a picture on a page (b) makes a link (c) sets colours and fonts (d) makes a form box
  13. 13.Which of these does CSS do? (a) makes headings and lists (b) changes the text size (c) changes the page live (d) makes a form box
  14. 14.True or false: JavaScript reacts to a button click. (a) False (b) True
  15. 15.Which of these does HTML do? (a) changes the text size (b) rounds box corners (c) puts a picture on a page (d) adds space around boxes
  16. 16.✍️ What value is given to font-weight in this rule?
    p {
      width: 300px;
      font-weight: bold;
      margin: 10px;
    }
    (a) 2px solid (b) bold (c) font-weight (d) 300px
  17. 17.⚖️ Which selector is the strongest? (a) an id selector (b) an element selector (c) a class selector
  18. 18.⚖️ What colour is the text of this element?
    <h2 class="big" id="logo">Hi</h2>
    CSS:
    h2 { color: green; }
    #logo { color: blue; }
    .big { color: red; }
    (a) purple (b) blue (c) green (d) red
  19. 19.💪 Which flexbox property turns on flexbox? (a) align-items (b) justify-content (c) display: flex (d) gap
  20. 20.🔍 Which is the odd one out? (a) makes a form box (b) adds space around boxes (c) sets colours and fonts (d) lays out the page
  21. 21.📱 What does a media query check? (a) the page title (b) the time of day (c) the screen width (d) the battery level
  22. 22.True or false: the border is a solid or dotted edge. (a) False (b) True
  23. 23.🎯 What kind of selector is #logo? (a) an id selector (b) an element selector (c) a class selector
  24. 24.What does justify-content: flex-start do? (a) puts boxes in the middle (b) packs boxes at the end (c) packs boxes at the start (d) equal gaps, none at ends
  25. 25.📦 In the box model, which part is the text or picture? (a) padding (b) border (c) margin (d) content
  26. 26.🧩 Which language makes a form box? (a) HTML (b) CSS (c) JavaScript
  27. 27.⚖️ What colour is the text of this element?
    <h2 class="note" id="top">Hi</h2>
    CSS:
    #top { color: blue; }
    #top { color: red; }
    (a) purple (b) blue (c) yellow (d) red
  28. 28.🌈 Which colour is rgb(255, 255, 0)? (a) blue (b) yellow (c) black (d) cyan
  29. 29.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 320px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 60px wide (no margins).
  30. 30.True or false: #main is an id selector. (a) True (b) False
  31. 31.⚖️ What colour is the text of this element?
    <p class="big" id="intro">Hi</p>
    CSS:
    p { color: blue; }
    #intro { color: yellow; }
    .big { color: green; }
    (a) yellow (b) blue (c) red (d) green
  32. 32.✍️ What is the selector in this CSS rule?
    #top {
      padding: 8px;
      color: red;
      font-size: 20px;
      margin: 10px;
    }
    (a) red (b) li (c) padding (d) #top
  33. 33.🌈 In #bd0000 the red part is the hex number bd. What is it as a normal number?
  34. 34.What does color do? (a) sets the letter colour (b) picks the font style (c) colours behind the text (d) makes the text bold
  35. 35.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      width: 300px;
      margin: 10px;
    }
  36. 36.🌈 Which colour is #0000ff? (a) cyan (b) blue (c) yellow (d) black
  37. 37.📱 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
  38. 38.🎨 One CSS file can style how many pages? (a) no pages (b) only one image (c) many pages (d) only one word
  39. 39.🌈 In #00008d the blue part is the hex number 8d. What is it as a normal number?
  40. 40.🔍 Which is the odd one out? (a) checks a quiz answer (b) lays out the page (c) sets colours and fonts (d) rounds box corners

Answer key

  1. rounds box corners
  2. yellow
  3. .
  4. <h1 class="big">
  5. purple
  6. white
  7. CSS
  8. green
  9. the viewport meta tag
  10. #intro
  11. background-color
  12. sets colours and fonts
  13. changes the text size
  14. True
  15. puts a picture on a page
  16. bold
  17. an id selector
  18. blue
  19. display: flex
  20. makes a form box
  21. the screen width
  22. True
  23. an id selector
  24. packs boxes at the start
  25. content
  26. HTML
  27. red
  28. yellow
  29. 80
  30. True
  31. yellow
  32. #top
  33. 189
  34. sets the letter colour
  35. 2
  36. blue
  37. Yes
  38. many pages
  39. 141
  40. checks a quiz answer

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