← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 141 · 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 colour is #000000? (a) bright green (b) cyan (c) magenta (d) black
  2. 2.📱 max-width: 600px applies when the screen is ___. (a) turned off (b) 600px or narrower (c) 600px or wider (d) exactly 1000px
  3. 3.🎯 Which sign starts a class selector? (a) # (b) . (c) @ (d) &
  4. 4.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 290px;
      padding: 20px;
      border: 1px solid black;
      margin: 0px;
    }
  5. 5.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 110px;
      padding: 20px;
      border: 5px solid black;
      margin: 15px;
    }
  6. 6.📦 In the box model, which part is the text or picture? (a) margin (b) content (c) border (d) padding
  7. 7.📦 In the box model, which part is space inside the border? (a) padding (b) margin (c) border (d) content
  8. 8.⚖️ Which selector is the strongest? (a) an id selector (b) an element selector (c) a class selector
  9. 9.📦 In the box model, which part is the gap round content? (a) padding (b) margin (c) content (d) border
  10. 10.🎯 Which element does the selector .star style? (a) <h1 class="menu"> (b) <h1 id="star"> (c) <h1 class="star"> (d) <h2 class="note">
  11. 11.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      margin: 10px;
      padding: 8px;
      color: red;
      border: 2px solid;
    }
  12. 12.🖌️ How big is the text, in px?
    li {
      font-size: 24px;
      background-color: purple;
      text-align: center;
      color: red;
    }
  13. 13.🔍 Which is the odd one out? (a) makes a link (b) makes a form box (c) makes headings and lists (d) shows a pop-up message
  14. 14.🎯 Which CSS selector matches this element?
    <li class="red" id="main">Hello</li>
    (a) #main (b) div (c) .main (d) #logo
  15. 15.True or false: HTML reacts to a button click. (a) True (b) False
  16. 16.⚖️ What colour is the text of this element?
    <h1 class="box" id="intro">Hi</h1>
    CSS:
    .box { color: purple; }
    #intro { color: red; }
    (a) black (b) red (c) white (d) purple
  17. 17.✍️ Which sign ends each CSS declaration? (a) . (b) , (c) ; (d) :
  18. 18.🎯 Which CSS selector matches this element?
    <p class="red" id="top">Hello</p>
    (a) h1 (b) .box (c) .top (d) p
  19. 19.🔍 Which is the odd one out? (a) puts a picture on a page (b) makes a form box (c) gives the page structure (d) adds space around boxes
  20. 20.True or false: padding is the gap round content. (a) False (b) True
  21. 21.True or false: the border is space outside the border. (a) True (b) False
  22. 22.🌈 Which hex code is cyan? (a) #0000ff (b) #00ffff (c) #000000 (d) #ff00ff
  23. 23.🖌️ How big is the text, in px?
    p {
      background-color: white;
      color: green;
      text-align: left;
      font-size: 20px;
    }
  24. 24.💪 Which justify-content value packs boxes at the start? (a) flex-end (b) center (c) space-between (d) flex-start
  25. 25.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 240px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 40px wide (no margins).
  26. 26.🌈 In #0b0000 the red part is the hex number 0b. What is it as a normal number?
  27. 27.⚖️ What colour is the text of this element?
    <p class="note" id="hero">Hi</p>
    CSS:
    #hero { color: black; }
    .note { color: white; }
    p { color: red; }
    (a) black (b) blue (c) white (d) red
  28. 28.⚖️ What colour is the text of this element?
    <p class="big" id="intro">Hi</p>
    CSS:
    #intro { color: blue; }
    p { color: white; }
    (a) blue (b) purple (c) red (d) white
  29. 29.🖌️ How big is the text, in px?
    p {
      color: white;
      font-size: 16px;
      text-align: center;
      background-color: black;
    }
  30. 30.🖌️ Which CSS property sets the letter colour? (a) background-color (b) color (c) font-size (d) font-family
  31. 31.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 18px;
      }
    }
    (a) Yes (b) No
  32. 32.🎯 What kind of selector is #main? (a) an id selector (b) an element selector (c) a class selector
  33. 33.⚖️ What colour is the text of this element?
    <h1 class="note" id="end">Hi</h1>
    CSS:
    h1 { color: yellow; }
    h1 { color: blue; }
    (a) green (b) black (c) blue (d) yellow
  34. 34.🎨 Which tag connects an outside CSS file? (a) <link> (b) <css> (c) <a> (d) <img>
  35. 35.Which of these is the content? (a) the text or picture (b) a solid or dotted edge (c) the gap to other boxes (d) space inside the border
  36. 36.🎯 Which CSS selector matches this element?
    <h2 class="box" id="top">Hello</h2>
    (a) h2 (b) .top (c) #box (d) #intro
  37. 37.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 20px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 16px;
      }
    }
    (a) Yes (b) No
  38. 38.✍️ What value is given to font-style in this rule?
    body {
      font-style: italic;
      font-size: 20px;
      width: 300px;
      text-align: center;
    }
    (a) italic (b) 20px (c) font-style (d) red
  39. 39.True or false: CSS sets colours and fonts. (a) False (b) True
  40. 40.📱 The screen is 820px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 18px;
      }
    }
    (a) No (b) Yes

Answer key

  1. black
  2. 600px or narrower
  3. .
  4. 332
  5. 190
  6. content
  7. padding
  8. an id selector
  9. padding
  10. <h1 class="star">
  11. 4
  12. 24
  13. shows a pop-up message
  14. #main
  15. False
  16. red
  17. ;
  18. p
  19. adds space around boxes
  20. True
  21. False
  22. #00ffff
  23. 20
  24. flex-start
  25. 80
  26. 11
  27. black
  28. blue
  29. 16
  30. color
  31. No
  32. an id selector
  33. blue
  34. <link>
  35. the text or picture
  36. h2
  37. Yes
  38. italic
  39. True
  40. Yes

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