← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 457 · 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 CSS selector matches this element?
    <li class="star" id="intro">Hello</li>
    (a) #main (b) .star (c) #star (d) .intro
  2. 2.🎯 Which sign starts a class selector? (a) & (b) @ (c) # (d) .
  3. 3.🎯 Which element does the selector p style? (a) <li id="main"> (b) <p class="box"> (c) <h2 class="box"> (d) <h1>
  4. 4.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 10px;
      }
    }
    (a) No (b) Yes
  5. 5.🎯 Which CSS selector matches this element?
    <div class="note" id="top">Hello</div>
    (a) .note (b) #intro (c) #note (d) span
  6. 6.Which of these does CSS do? (a) puts a picture on a page (b) gives the page structure (c) rounds box corners (d) makes a form box
  7. 7.🎯 How many elements on a page should have the same id? (a) any number (b) 1 (c) 2 (d) 5
  8. 8.💪 Which flexbox property sets space between boxes? (a) justify-content (b) align-items (c) gap (d) display: flex
  9. 9.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 180px;
      padding: 20px;
      border: 2px solid black;
      margin: 15px;
    }
  10. 10.🎯 Which element does the selector #intro style? (a) <span class="menu"> (b) <div id="main"> (c) <div class="intro"> (d) <div id="intro">
  11. 11.🧩 Which language makes headings and lists? (a) HTML (b) JavaScript (c) CSS
  12. 12.📱 max-width: 600px applies when the screen is ___. (a) turned off (b) exactly 1000px (c) 600px or narrower (d) 600px or wider
  13. 13.🖌️ Which CSS property sets the letter colour? (a) color (b) font-size (c) text-align (d) font-family
  14. 14.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 240px;
      padding: 10px;
      border: 2px solid black;
      margin: 5px;
    }
  15. 15.🎯 What kind of selector is #main? (a) an id selector (b) a class selector (c) an element selector
  16. 16.📱 The screen is 1366px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 14px;
      }
    }
    (a) No (b) Yes
  17. 17.🌈 Which colour of light is strongest in rgb(211, 83, 8)? (a) red (b) blue (c) green
  18. 18.✍️ What value is given to width in this rule?
    .box {
      color: red;
      margin: 10px;
      width: 300px;
    }
    (a) width (b) red (c) italic (d) 300px
  19. 19.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 280px;
      padding: 20px;
      border: 4px solid black;
      margin: 10px;
    }
  20. 20.✍️ Which property is set to 2px solid in this rule?
    .box {
      border: 2px solid;
      text-align: center;
    }
    (a) 2px solid (b) font-style (c) border (d) width
  21. 21.🔍 Which is the odd one out? (a) makes a form box (b) makes a link (c) makes headings and lists (d) lays out the page
  22. 22.🌈 What is the biggest number one colour can have in rgb()? (a) 1000 (b) 255 (c) 99 (d) 100
  23. 23.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 30px;
      }
    }
  24. 24.⚖️ What colour is the text of this element?
    <h2 class="menu" id="logo">Hi</h2>
    CSS:
    .menu { color: red; }
    h2 { color: orange; }
    #logo { color: green; }
    (a) red (b) orange (c) green (d) blue
  25. 25.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 280px;
      padding: 20px;
      border: 4px solid black;
      margin: 20px;
    }
  26. 26.🌈 Which hex code is cyan? (a) #000000 (b) #00ffff (c) #0000ff (d) #ffffff
  27. 27.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 768px) {
      p {
        font-size: 14px;
      }
    }
  28. 28.✍️ Which sign goes between a property and its value? (a) : (b) ; (c) = (d) -
  29. 29.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 140px;
      padding: 20px;
      border: 2px solid black;
      margin: 15px;
    }
  30. 30.True or false: padding is space inside the border. (a) False (b) True
  31. 31.✍️ Which property is set to 10px in this rule?
    .box {
      background-color: yellow;
      font-style: italic;
      margin: 10px;
    }
    (a) font-weight (b) padding (c) 10px (d) margin
  32. 32.🎯 Can many elements share the same class? (a) Yes (b) No
  33. 33.🎨 Which attribute adds CSS inside one tag? (a) style (b) src (c) href (d) alt
  34. 34.🎨 What does CSS stand for? (a) Computer Style Sheets (b) Creative Sheet System (c) Colourful Site Styles (d) Cascading Style Sheets
  35. 35.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 180px;
      padding: 25px;
      border: 5px solid black;
      margin: 20px;
    }
  36. 36.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 20px;
      }
    }
  37. 37.✍️ What is the selector in this CSS rule?
    li {
      width: 300px;
      font-style: italic;
      border: 2px solid;
      background-color: yellow;
    }
    (a) width (b) li (c) italic (d) body
  38. 38.🎨 Which tag connects an outside CSS file? (a) <a> (b) <css> (c) <img> (d) <link>
  39. 39.🎯 What kind of selector is .star? (a) a class selector (b) an id selector (c) an element selector
  40. 40.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 26px;
      }
    }

Answer key

  1. .star
  2. .
  3. <p class="box">
  4. Yes
  5. .note
  6. rounds box corners
  7. 1
  8. gap
  9. 254
  10. <div id="intro">
  11. HTML
  12. 600px or narrower
  13. color
  14. 264
  15. an id selector
  16. No
  17. red
  18. 300px
  19. 348
  20. border
  21. lays out the page
  22. 255
  23. 24
  24. green
  25. 368
  26. #00ffff
  27. 20
  28. :
  29. 214
  30. True
  31. margin
  32. Yes
  33. style
  34. Cascading Style Sheets
  35. 280
  36. 20
  37. li
  38. <link>
  39. a class selector
  40. 26

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