← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 917 · 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.⚖️ Two rules with the same selector set a colour. Which one wins? (a) neither (b) the shorter one (c) the later one (d) the first one
  2. 2.What does justify-content: flex-start do? (a) equal gaps, none at ends (b) packs boxes at the start (c) packs boxes at the end (d) puts boxes in the middle
  3. 3.⚖️ Which selector is the weakest? (a) a class selector (b) an element selector (c) an id selector
  4. 4.🌈 In #0000dc the blue part is the hex number dc. What is it as a normal number?
  5. 5.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 80px;
      padding: 10px;
      border: 1px solid black;
      margin: 5px;
    }
  6. 6.📦 In the box model, which part is the line round the box? (a) padding (b) margin (c) content (d) border
  7. 7.📱 min-width: 800px applies when the screen is ___. (a) 800px or wider (b) 800px or narrower (c) turned off (d) exactly 100px
  8. 8.✍️ How many declarations (property: value pairs) are in this rule?
    .note {
      background-color: yellow;
      border: 2px solid;
      font-style: italic;
    }
  9. 9.🖌️ What colour is behind the letters?
    h1 {
      color: blue;
      text-align: center;
      font-size: 40px;
      background-color: green;
    }
    (a) yellow (b) blue (c) green
  10. 10.🌈 Which hex code is magenta? (a) #ffffff (b) #00ffff (c) #ff0000 (d) #ff00ff
  11. 11.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 4 (b) 3 (c) 6 (d) 2
  12. 12.⚖️ What colour is the text of this element?
    <p class="menu" id="logo">Hi</p>
    CSS:
    #logo { color: orange; }
    p { color: blue; }
    .menu { color: white; }
    (a) black (b) blue (c) white (d) orange
  13. 13.✍️ What is the selector in this CSS rule?
    p {
      color: red;
      padding: 8px;
    }
    (a) .note (b) 8px (c) color (d) p
  14. 14.🎨 What does CSS stand for? (a) Computer Style Sheets (b) Cascading Style Sheets (c) Creative Sheet System (d) Colourful Site Styles
  15. 15.⚖️ What colour is the text of this element?
    <p class="box" id="intro">Hi</p>
    CSS:
    p { color: black; }
    #intro { color: orange; }
    (a) orange (b) black (c) red (d) purple
  16. 16.📱 max-width: 600px applies when the screen is ___. (a) turned off (b) 600px or wider (c) exactly 1000px (d) 600px or narrower
  17. 17.🖌️ What colour are the letters?
    h1 {
      background-color: orange;
      color: red;
      text-align: left;
      font-size: 24px;
    }
    (a) orange (b) yellow (c) red
  18. 18.⚖️ What colour is the text of this element?
    <h2 class="big" id="end">Hi</h2>
    CSS:
    #end { color: orange; }
    #end { color: blue; }
    (a) orange (b) purple (c) red (d) blue
  19. 19.📦 In the box model, which part is the gap to other boxes? (a) margin (b) content (c) border (d) padding
  20. 20.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 18px;
      }
    }
  21. 21.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 170px;
      padding: 30px;
      border: 2px solid black;
      margin: 5px;
    }
  22. 22.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 150px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 60px wide (no margins).
  23. 23.🌈 Hex digits go 0 to 9, then A to which letter? (a) G (b) F (c) J (d) Z
  24. 24.🔍 Which is the odd one out? (a) shows a pop-up message (b) checks a quiz answer (c) changes the page live (d) puts a picture on a page
  25. 25.✍️ What value is given to padding in this rule?
    p {
      padding: 8px;
      border: 2px solid;
      font-style: italic;
    }
    (a) bold (b) padding (c) 2px solid (d) 8px
  26. 26.Which of these does JavaScript do? (a) lays out the page (b) reacts to a button click (c) sets colours and fonts (d) adds space around boxes
  27. 27.🌈 Which hex code is black? (a) #00ff00 (b) #0000ff (c) #00ffff (d) #000000
  28. 28.🎨 One CSS file can style how many pages? (a) only one word (b) only one image (c) many pages (d) no pages
  29. 29.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 16px;
      }
    }
  30. 30.Which of these does HTML do? (a) reacts to a button click (b) adds space around boxes (c) makes a link (d) rounds box corners
  31. 31.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 60px;
      padding: 15px;
      border: 4px solid black;
      margin: 10px;
    }
  32. 32.🎯 Which element does the selector h2 style? (a) <span id="hero"> (b) <li> (c) <h2 class="note"> (d) <div class="note">
  33. 33.What does justify-content: flex-end do? (a) packs boxes at the end (b) packs boxes at the start (c) equal gaps, none at ends (d) puts boxes in the middle
  34. 34.⚖️ What colour is the text of this element?
    <h2 class="menu" id="top">Hi</h2>
    CSS:
    #top { color: green; }
    #top { color: purple; }
    (a) orange (b) white (c) purple (d) green
  35. 35.🌈 In #001d00 the green part is the hex number 1d. What is it as a normal number?
  36. 36.📱 The screen is 375px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 14px;
      }
    }
  37. 37.✍️ What value is given to color in this rule?
    h1 {
      background-color: yellow;
      color: red;
      padding: 8px;
    }
    (a) color (b) center (c) 20px (d) red
  38. 38.📱 What does a media query check? (a) the battery level (b) the time of day (c) the screen width (d) the page title
  39. 39.✍️ What is the selector in this CSS rule?
    h2 {
      margin: 10px;
      width: 300px;
      font-style: italic;
    }
    (a) margin (b) h1 (c) 300px (d) h2
  40. 40.🌈 In #610000 the red part is the hex number 61. What is it as a normal number?

Answer key

  1. the later one
  2. packs boxes at the start
  3. an element selector
  4. 220
  5. 112
  6. border
  7. 800px or wider
  8. 3
  9. green
  10. #ff00ff
  11. 3
  12. orange
  13. p
  14. Cascading Style Sheets
  15. orange
  16. 600px or narrower
  17. red
  18. blue
  19. margin
  20. 20
  21. 244
  22. 30
  23. F
  24. puts a picture on a page
  25. 8px
  26. reacts to a button click
  27. #000000
  28. many pages
  29. 16
  30. makes a link
  31. 118
  32. <h2 class="note">
  33. packs boxes at the end
  34. purple
  35. 29
  36. 12
  37. red
  38. the screen width
  39. h2
  40. 97

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