← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 728 · 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 empty space (px) is before the first box?
    .row {
      display: flex;
      width: 220px;
      justify-content: center;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  2. 2.What does font-weight do? (a) centres a heading (b) makes the text bold (c) picks the font style (d) sets the letter colour
  3. 3.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 18px;
      }
    }
    (a) Yes (b) No
  4. 4.✍️ What value is given to width in this rule?
    .box {
      width: 300px;
      font-weight: bold;
      font-size: 20px;
      padding: 8px;
    }
    (a) width (b) 300px (c) red (d) italic
  5. 5.🖌️ What colour are the letters?
    p {
      background-color: green;
      color: white;
      font-size: 40px;
      text-align: right;
    }
    (a) green (b) white (c) blue
  6. 6.What does background-color do? (a) sets the letter colour (b) makes letters bigger (c) colours behind the text (d) centres a heading
  7. 7.💪 Which justify-content value packs boxes at the start? (a) flex-start (b) center (c) flex-end (d) space-between
  8. 8.⚖️ What colour is the text of this element?
    <p class="red" id="intro">Hi</p>
    CSS:
    .red { color: red; }
    .red { color: green; }
    (a) black (b) red (c) green (d) purple
  9. 9.✍️ Which property is set to yellow in this rule?
    h1 {
      background-color: yellow;
      width: 300px;
    }
    (a) yellow (b) margin (c) padding (d) background-color
  10. 10.✍️ Which sign goes between a property and its value? (a) : (b) = (c) ; (d) -
  11. 11.🎯 What kind of selector is #main? (a) a class selector (b) an id selector (c) an element selector
  12. 12.What does justify-content: flex-start do? (a) puts boxes in the middle (b) packs boxes at the end (c) equal gaps, none at ends (d) packs boxes at the start
  13. 13.🌈 Which hex code is bright green? (a) #ff0000 (b) #ffffff (c) #00ff00 (d) #0000ff
  14. 14.✍️ What value is given to font-size in this rule?
    #top {
      font-style: italic;
      font-size: 20px;
      font-weight: bold;
    }
    (a) 20px (b) yellow (c) font-size (d) center
  15. 15.🎨 What does CSS stand for? (a) Computer Style Sheets (b) Creative Sheet System (c) Colourful Site Styles (d) Cascading Style Sheets
  16. 16.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 110px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  17. 17.🎨 One CSS file can style how many pages? (a) only one word (b) only one image (c) no pages (d) many pages
  18. 18.🖌️ What colour are the letters?
    li {
      background-color: green;
      color: white;
      font-size: 36px;
      text-align: right;
    }
    (a) white (b) green (c) blue
  19. 19.🌈 Which colour of light is strongest in rgb(17, 82, 196)? (a) red (b) blue (c) green
  20. 20.🧩 Which language rounds box corners? (a) JavaScript (b) HTML (c) CSS
  21. 21.🧩 Which language makes a link? (a) CSS (b) JavaScript (c) HTML
  22. 22.⚖️ What colour is the text of this element?
    <p class="red" id="intro">Hi</p>
    CSS:
    p { color: black; }
    .red { color: orange; }
    (a) black (b) red (c) yellow (d) orange
  23. 23.📱 The screen is 1100px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 8px;
      }
    }
    (a) Yes (b) No
  24. 24.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 260px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 80px wide (no margins).
  25. 25.🌈 Which hex code is white? (a) #ffff00 (b) #ffffff (c) #ff00ff (d) #0000ff
  26. 26.📱 min-width: 800px applies when the screen is ___. (a) turned off (b) exactly 100px (c) 800px or narrower (d) 800px or wider
  27. 27.Which of these does HTML do? (a) lays out the page (b) shows a pop-up message (c) puts a picture on a page (d) rounds box corners
  28. 28.🌈 In #00000a the blue part is the hex number 0a. What is it as a normal number?
  29. 29.Which of these does JavaScript do? (a) changes the text size (b) reacts to a button click (c) puts a picture on a page (d) makes headings and lists
  30. 30.What does font-family do? (a) makes letters bigger (b) sets the letter colour (c) centres a heading (d) picks the font style
  31. 31.True or false: CSS makes a link. (a) False (b) True
  32. 32.📱 The screen is 700px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 18px;
      }
    }
  33. 33.🧩 Which language adds space around boxes? (a) JavaScript (b) CSS (c) HTML
  34. 34.⚖️ What colour is the text of this element?
    <p class="menu" id="logo">Hi</p>
    CSS:
    .menu { color: black; }
    p { color: green; }
    (a) blue (b) green (c) black (d) white
  35. 35.🌈 Which colour of light is strongest in rgb(198, 31, 26)? (a) green (b) blue (c) red
  36. 36.True or false: the border is a solid or dotted edge. (a) True (b) False
  37. 37.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 170px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 80px wide (no margins).
  38. 38.🖌️ What colour are the letters?
    p {
      color: orange;
      text-align: right;
      font-size: 16px;
      background-color: purple;
    }
    (a) purple (b) green (c) orange
  39. 39.🎯 Which CSS selector matches this element?
    <p class="box" id="logo">Hello</p>
    (a) #box (b) #end (c) h1 (d) .box
  40. 40.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 32px;
      }
    }
    (a) No (b) Yes

Answer key

  1. 50
  2. makes the text bold
  3. Yes
  4. 300px
  5. white
  6. colours behind the text
  7. flex-start
  8. green
  9. background-color
  10. :
  11. an id selector
  12. packs boxes at the start
  13. #00ff00
  14. 20px
  15. Cascading Style Sheets
  16. 10
  17. many pages
  18. white
  19. blue
  20. CSS
  21. HTML
  22. orange
  23. No
  24. 20
  25. #ffffff
  26. 800px or wider
  27. puts a picture on a page
  28. 10
  29. reacts to a button click
  30. picks the font style
  31. False
  32. 18
  33. CSS
  34. black
  35. red
  36. True
  37. 10
  38. orange
  39. .box
  40. No

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