← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 641 · 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 of these is the content? (a) a solid or dotted edge (b) the text or picture (c) space inside the border (d) the gap to other boxes
  2. 2.🌈 In #rrggbb, which colour do the first two digits give? (a) blue (b) green (c) black (d) red
  3. 3.🌈 Which hex code is yellow? (a) #00ffff (b) #ffff00 (c) #00ff00 (d) #ff0000
  4. 4.🔍 Which is the odd one out? (a) sets colours and fonts (b) gives the page structure (c) rounds box corners (d) adds space around boxes
  5. 5.⚖️ What colour is the text of this element?
    <h1 class="big" id="hero">Hi</h1>
    CSS:
    h1 { color: blue; }
    h1 { color: red; }
    (a) red (b) purple (c) blue (d) orange
  6. 6.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 40px;
      padding: 25px;
      border: 1px solid black;
      margin: 20px;
    }
  7. 7.📱 Responsive design means a page ___. (a) never changes (b) is only for laptops (c) fits every screen (d) has no pictures
  8. 8.🌈 Which colour of light is strongest in rgb(30, 227, 84)? (a) red (b) blue (c) green
  9. 9.✍️ What value is given to padding in this rule?
    li {
      font-weight: bold;
      color: red;
      padding: 8px;
    }
    (a) 2px solid (b) 8px (c) padding (d) bold
  10. 10.True or false: HTML makes headings and lists. (a) True (b) False
  11. 11.🎨 What does CSS stand for? (a) Cascading Style Sheets (b) Colourful Site Styles (c) Computer Style Sheets (d) Creative Sheet System
  12. 12.What does font-family do? (a) centres a heading (b) makes the text bold (c) colours behind the text (d) picks the font style
  13. 13.Which of these is margin? (a) the gap to other boxes (b) a solid or dotted edge (c) the text or picture (d) the line round the box
  14. 14.🖌️ How big is the text, in px?
    h1 {
      text-align: center;
      color: yellow;
      font-size: 20px;
      background-color: red;
    }
  15. 15.🎨 Which attribute adds CSS inside one tag? (a) style (b) src (c) href (d) alt
  16. 16.🔍 Which is the odd one out? (a) changes the text size (b) sets colours and fonts (c) lays out the page (d) makes headings and lists
  17. 17.🖌️ Where does the text sit on its line?
    p {
      color: yellow;
      text-align: left;
      font-size: 24px;
      background-color: white;
    }
    (a) on the left (b) on the right (c) in the middle
  18. 18.📱 The screen is 540px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 20px;
      }
    }
    (a) No (b) Yes
  19. 19.✍️ In color: blue; which part is the value? (a) color (b) blue (c) : (d) ;
  20. 20.⚖️ What colour is the text of this element?
    <h2 class="big" id="top">Hi</h2>
    CSS:
    #top { color: purple; }
    h2 { color: black; }
    .big { color: red; }
    (a) blue (b) black (c) red (d) purple
  21. 21.🌈 Which hex code is white? (a) #ffff00 (b) #ff0000 (c) #ffffff (d) #0000ff
  22. 22.✍️ What value is given to color in this rule?
    #top {
      text-align: center;
      color: red;
    }
    (a) center (b) 20px (c) red (d) color
  23. 23.🌈 Which colour of light is strongest in rgb(45, 238, 34)? (a) red (b) green (c) blue
  24. 24.🎯 What kind of selector is .card? (a) an element selector (b) a class selector (c) an id selector
  25. 25.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      padding: 8px;
      border: 2px solid;
    }
  26. 26.⚖️ What colour is the text of this element?
    <h1 class="menu" id="top">Hi</h1>
    CSS:
    h1 { color: red; }
    #top { color: yellow; }
    (a) orange (b) red (c) green (d) yellow
  27. 27.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 260px;
      padding: 25px;
      border: 5px solid black;
      margin: 0px;
    }
  28. 28.🎯 What kind of selector is p? (a) a class selector (b) an id selector (c) an element selector
  29. 29.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 10px;
      }
    }
  30. 30.True or false: padding is the gap round content. (a) True (b) False
  31. 31.🧩 Which language reacts to a button click? (a) HTML (b) JavaScript (c) CSS
  32. 32.🖌️ Where does the text sit on its line?
    p {
      text-align: left;
      color: purple;
      background-color: blue;
      font-size: 16px;
    }
    (a) in the middle (b) on the right (c) on the left
  33. 33.True or false: .menu is an id selector. (a) True (b) False
  34. 34.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 550px;
      justify-content: space-between;
    }
    Inside are 4 boxes, each 100px wide (no margins).
  35. 35.⚖️ What colour is the text of this element?
    <h1 class="menu" id="intro">Hi</h1>
    CSS:
    .menu { color: purple; }
    .menu { color: orange; }
    (a) orange (b) purple (c) red (d) white
  36. 36.⚖️ What colour is the text of this element?
    <p class="red" id="end">Hi</p>
    CSS:
    p { color: purple; }
    .red { color: white; }
    #end { color: black; }
    (a) black (b) purple (c) red (d) white
  37. 37.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 270px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  38. 38.What does justify-content: flex-end do? (a) equal gaps, none at ends (b) packs boxes at the end (c) packs boxes at the start (d) puts boxes in the middle
  39. 39.What does font-size do? (a) sets the letter colour (b) picks the font style (c) centres a heading (d) makes letters bigger
  40. 40.✍️ CSS declarations go inside which brackets? (a) < > (b) { } (c) ( ) (d) [ ]

Answer key

  1. the text or picture
  2. red
  3. #ffff00
  4. gives the page structure
  5. red
  6. 132
  7. fits every screen
  8. green
  9. 8px
  10. True
  11. Cascading Style Sheets
  12. picks the font style
  13. the gap to other boxes
  14. 20
  15. style
  16. makes headings and lists
  17. on the left
  18. Yes
  19. blue
  20. purple
  21. #ffffff
  22. red
  23. green
  24. a class selector
  25. 2
  26. yellow
  27. 320
  28. an element selector
  29. 10
  30. True
  31. JavaScript
  32. on the left
  33. False
  34. 50
  35. orange
  36. black
  37. 70
  38. packs boxes at the end
  39. makes letters bigger
  40. { }

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