← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 543 · 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 justify-content value packs boxes at the start? (a) space-between (b) center (c) flex-start (d) flex-end
  2. 2.🖌️ What colour are the letters?
    h1 {
      text-align: center;
      font-size: 36px;
      background-color: white;
      color: orange;
    }
    (a) white (b) red (c) orange
  3. 3.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 260px;
      padding: 15px;
      border: 1px solid black;
      margin: 5px;
    }
  4. 4.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 16px;
      }
    }
  5. 5.True or false: margin is space outside the border. (a) False (b) True
  6. 6.🎯 What kind of selector is #logo? (a) an element selector (b) a class selector (c) an id selector
  7. 7.🌈 Which colour of light is strongest in rgb(240, 101, 26)? (a) green (b) red (c) blue
  8. 8.🎯 Which element does the selector .box style? (a) <p id="box"> (b) <p class="star"> (c) <p class="box"> (d) <h1 class="menu">
  9. 9.✍️ What is the selector in this CSS rule?
    p {
      font-style: italic;
      width: 300px;
    }
    (a) 300px (b) font-style (c) p (d) .note
  10. 10.⚖️ Which selector is the strongest? (a) a class selector (b) an element selector (c) an id selector
  11. 11.💪 Which flexbox property sets space between boxes? (a) align-items (b) gap (c) flex-direction (d) display: flex
  12. 12.🖌️ What colour are the letters?
    h1 {
      text-align: left;
      font-size: 36px;
      background-color: purple;
      color: red;
    }
    (a) white (b) purple (c) red
  13. 13.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 320px;
      justify-content: flex-end;
    }
    Inside are 3 boxes, each 80px wide (no margins).
  14. 14.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      color: red;
    }
  15. 15.✍️ What is the selector in this CSS rule?
    #top {
      font-weight: bold;
      margin: 10px;
    }
    (a) li (b) 10px (c) #top (d) font-weight
  16. 16.🌈 Which colour of light is strongest in rgb(250, 132, 132)? (a) red (b) blue (c) green
  17. 17.🎨 Which tag connects an outside CSS file? (a) <link> (b) <img> (c) <a> (d) <css>
  18. 18.✍️ What value is given to font-weight in this rule?
    h1 {
      border: 2px solid;
      text-align: center;
      font-weight: bold;
      font-size: 20px;
    }
    (a) font-weight (b) 300px (c) bold (d) 2px solid
  19. 19.📱 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
  20. 20.🧩 Which language makes a link? (a) JavaScript (b) HTML (c) CSS
  21. 21.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the first one (b) the shorter one (c) neither (d) the later one
  22. 22.🌈 Which colour is #00ffff? (a) yellow (b) black (c) bright green (d) cyan
  23. 23.⚖️ What colour is the text of this element?
    <p class="note" id="top">Hi</p>
    CSS:
    p { color: blue; }
    p { color: white; }
    (a) white (b) yellow (c) green (d) blue
  24. 24.🎨 A CSS file usually ends with which extension? (a) .js (b) .css (c) .html (d) .png
  25. 25.⚖️ What colour is the text of this element?
    <h1 class="red" id="top">Hi</h1>
    CSS:
    .red { color: yellow; }
    .red { color: blue; }
    (a) purple (b) blue (c) green (d) yellow
  26. 26.🌈 In #00bf00 the green part is the hex number bf. What is it as a normal number?
  27. 27.✍️ What is the selector in this CSS rule?
    .box {
      padding: 8px;
      width: 300px;
      color: red;
    }
    (a) padding (b) .box (c) 300px (d) h2
  28. 28.⚖️ What colour is the text of this element?
    <h1 class="box" id="intro">Hi</h1>
    CSS:
    h1 { color: green; }
    h1 { color: black; }
    (a) black (b) green (c) yellow (d) purple
  29. 29.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 90px;
      padding: 25px;
      border: 1px solid black;
      margin: 0px;
    }
  30. 30.🌈 Hex digits go 0 to 9, then A to which letter? (a) G (b) Z (c) F (d) J
  31. 31.🖌️ Where does the text sit on its line?
    li {
      font-size: 12px;
      background-color: purple;
      text-align: right;
      color: orange;
    }
    (a) on the right (b) on the left (c) in the middle
  32. 32.🖌️ What colour are the letters?
    h2 {
      text-align: center;
      color: white;
      background-color: purple;
      font-size: 32px;
    }
    (a) purple (b) white (c) black
  33. 33.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 10px;
      }
    }
    (a) No (b) Yes
  34. 34.💪 Which flexbox property lines boxes up across? (a) flex-direction (b) display: flex (c) gap (d) align-items
  35. 35.Which of these is the content? (a) the text or picture (b) the line round the box (c) the gap round content (d) space inside the border
  36. 36.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      background-color: yellow;
    }
  37. 37.⚖️ What colour is the text of this element?
    <p class="big" id="logo">Hi</p>
    CSS:
    #logo { color: red; }
    p { color: black; }
    .big { color: green; }
    (a) black (b) green (c) orange (d) red
  38. 38.✍️ What value is given to background-color in this rule?
    body {
      font-style: italic;
      background-color: yellow;
    }
    (a) yellow (b) 8px (c) background-color (d) 10px
  39. 39.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 300px;
      justify-content: space-between;
    }
    Inside are 3 boxes, each 80px wide (no margins).
  40. 40.✍️ CSS declarations go inside which brackets? (a) < > (b) { } (c) ( ) (d) [ ]

Answer key

  1. flex-start
  2. orange
  3. 302
  4. 12
  5. True
  6. an id selector
  7. red
  8. <p class="box">
  9. p
  10. an id selector
  11. gap
  12. red
  13. 80
  14. 1
  15. #top
  16. red
  17. <link>
  18. bold
  19. the viewport meta tag
  20. HTML
  21. the later one
  22. cyan
  23. white
  24. .css
  25. blue
  26. 191
  27. .box
  28. black
  29. 142
  30. F
  31. on the right
  32. white
  33. No
  34. align-items
  35. the text or picture
  36. 1
  37. red
  38. yellow
  39. 30
  40. { }

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