← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 494 · 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 colour is the text of this element?
    <h1 class="star" id="main">Hi</h1>
    CSS:
    #main { color: red; }
    .star { color: orange; }
    h1 { color: black; }
    (a) red (b) yellow (c) black (d) orange
  2. 2.⚖️ Which selector is the strongest? (a) a class selector (b) an id selector (c) an element selector
  3. 3.📱 Which tag helps phones show a page at the right size? (a) the viewport meta tag (b) the title tag (c) the br tag (d) the hr tag
  4. 4.⚖️ What colour is the text of this element?
    <p class="note" id="hero">Hi</p>
    CSS:
    .note { color: black; }
    p { color: blue; }
    #hero { color: green; }
    (a) white (b) blue (c) black (d) green
  5. 5.✍️ Which sign ends each CSS declaration? (a) ; (b) : (c) , (d) .
  6. 6.🌈 What is the biggest number one colour can have in rgb()? (a) 100 (b) 255 (c) 1000 (d) 99
  7. 7.🖌️ Where does the text sit on its line?
    h2 {
      text-align: left;
      background-color: orange;
      color: yellow;
      font-size: 32px;
    }
    (a) in the middle (b) on the right (c) on the left
  8. 8.🖌️ Which CSS property makes letters bigger? (a) font-family (b) color (c) font-size (d) background-color
  9. 9.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      font-style: italic;
      color: red;
    }
  10. 10.✍️ What value is given to border in this rule?
    li {
      padding: 8px;
      color: red;
      border: 2px solid;
      margin: 10px;
    }
    (a) italic (b) border (c) 300px (d) 2px solid
  11. 11.🎯 Which CSS selector matches this element?
    <h2 class="note" id="end">Hello</h2>
    (a) #note (b) li (c) .big (d) #end
  12. 12.What does text-align do? (a) makes the text bold (b) centres a heading (c) colours behind the text (d) sets the letter colour
  13. 13.🎯 Which element does the selector .star style? (a) <span class="star"> (b) <span id="star"> (c) <span class="menu"> (d) <p class="note">
  14. 14.🌈 In #000038 the blue part is the hex number 38. What is it as a normal number?
  15. 15.✍️ What value is given to color in this rule?
    p {
      color: red;
      padding: 8px;
    }
    (a) color (b) center (c) red (d) 20px
  16. 16.⚖️ What colour is the text of this element?
    <h1 class="box" id="end">Hi</h1>
    CSS:
    #end { color: green; }
    #end { color: red; }
    (a) green (b) red (c) black (d) purple
  17. 17.⚖️ Which selector is the weakest? (a) an id selector (b) an element selector (c) a class selector
  18. 18.📱 The screen is 820px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 26px;
      }
    }
    (a) Yes (b) No
  19. 19.✍️ CSS declarations go inside which brackets? (a) < > (b) { } (c) [ ] (d) ( )
  20. 20.🖌️ Which CSS property sets the letter colour? (a) font-size (b) text-align (c) background-color (d) color
  21. 21.What does background-color do? (a) picks the font style (b) sets the letter colour (c) centres a heading (d) colours behind the text
  22. 22.What does justify-content: space-between do? (a) packs boxes at the end (b) packs boxes at the start (c) puts boxes in the middle (d) equal gaps, none at ends
  23. 23.💪 Which flexbox property sets space between boxes? (a) gap (b) display: flex (c) align-items (d) flex-direction
  24. 24.⚖️ What colour is the text of this element?
    <p class="star" id="hero">Hi</p>
    CSS:
    p { color: purple; }
    .star { color: black; }
    (a) purple (b) blue (c) red (d) black
  25. 25.True or false: CSS counts down a timer. (a) True (b) False
  26. 26.🎨 One CSS file can style how many pages? (a) only one word (b) many pages (c) only one image (d) no pages
  27. 27.Which of these is padding? (a) a solid or dotted edge (b) the text or picture (c) space inside the border (d) the gap to other boxes
  28. 28.🔍 Which is the odd one out? (a) changes the page live (b) gives the page structure (c) makes headings and lists (d) makes a form box
  29. 29.🌈 In #rrggbb, which colour do the last two digits give? (a) green (b) blue (c) white (d) red
  30. 30.🌈 Which hex code is cyan? (a) #00ffff (b) #000000 (c) #ff0000 (d) #0000ff
  31. 31.🌈 Which hex code is yellow? (a) #ff0000 (b) #ffff00 (c) #00ff00 (d) #ff00ff
  32. 32.🎯 What kind of selector is #main? (a) a class selector (b) an id selector (c) an element selector
  33. 33.⚖️ What colour is the text of this element?
    <h1 class="menu" id="top">Hi</h1>
    CSS:
    #top { color: red; }
    #top { color: white; }
    (a) purple (b) black (c) red (d) white
  34. 34.📱 What does a media query check? (a) the page title (b) the time of day (c) the screen width (d) the battery level
  35. 35.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 270px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  36. 36.🔍 Which is the odd one out? (a) sets colours and fonts (b) reacts to a button click (c) lays out the page (d) adds space around boxes
  37. 37.🎯 Which sign starts an id selector? (a) @ (b) & (c) . (d) #
  38. 38.🧩 Which language changes the page live? (a) JavaScript (b) HTML (c) CSS
  39. 39.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 190px;
      padding: 20px;
      border: 1px solid black;
      margin: 20px;
    }
  40. 40.🖌️ What colour are the letters?
    li {
      font-size: 24px;
      background-color: red;
      text-align: left;
      color: blue;
    }
    (a) red (b) blue (c) purple

Answer key

  1. red
  2. an id selector
  3. the viewport meta tag
  4. green
  5. ;
  6. 255
  7. on the left
  8. font-size
  9. 2
  10. 2px solid
  11. #end
  12. centres a heading
  13. <span class="star">
  14. 56
  15. red
  16. red
  17. an element selector
  18. No
  19. { }
  20. color
  21. colours behind the text
  22. equal gaps, none at ends
  23. gap
  24. black
  25. False
  26. many pages
  27. space inside the border
  28. changes the page live
  29. blue
  30. #00ffff
  31. #ffff00
  32. an id selector
  33. white
  34. the screen width
  35. 70
  36. reacts to a button click
  37. #
  38. JavaScript
  39. 232
  40. blue

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