← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 593 · 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) the text or picture (b) space outside the border (c) a solid or dotted edge (d) the gap round content
  2. 2.🎯 What kind of selector is .card? (a) an id selector (b) a class selector (c) an element selector
  3. 3.📱 The screen is 414px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 14px;
      }
    }
    (a) Yes (b) No
  4. 4.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 32px;
      }
    }
  5. 5.Which of these is the border? (a) the gap round content (b) the gap to other boxes (c) space outside the border (d) the line round the box
  6. 6.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 290px;
      padding: 10px;
      border: 5px solid black;
      margin: 5px;
    }
  7. 7.📱 The screen is 820px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 22px;
      }
    }
    (a) No (b) Yes
  8. 8.🎯 Which sign starts an id selector? (a) . (b) @ (c) & (d) #
  9. 9.📱 max-width: 600px applies when the screen is ___. (a) 600px or narrower (b) turned off (c) 600px or wider (d) exactly 1000px
  10. 10.✍️ Which property is set to 2px solid in this rule?
    p {
      border: 2px solid;
      background-color: yellow;
    }
    (a) width (b) 2px solid (c) font-style (d) border
  11. 11.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 300px;
      justify-content: flex-end;
    }
    Inside are 3 boxes, each 80px wide (no margins).
  12. 12.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 24px;
      }
    }
  13. 13.🎯 What kind of selector is #hero? (a) a class selector (b) an id selector (c) an element selector
  14. 14.🎯 What kind of selector is .big? (a) an id selector (b) a class selector (c) an element selector
  15. 15.True or false: HTML reacts to a button click. (a) True (b) False
  16. 16.✍️ In color: blue; which part is the value? (a) : (b) ; (c) color (d) blue
  17. 17.⚖️ What colour is the text of this element?
    <p class="red" id="end">Hi</p>
    CSS:
    .red { color: orange; }
    p { color: purple; }
    (a) orange (b) yellow (c) green (d) purple
  18. 18.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 140px;
      padding: 20px;
      border: 1px solid black;
      margin: 5px;
    }
  19. 19.🎯 How many elements on a page should have the same id? (a) any number (b) 2 (c) 5 (d) 1
  20. 20.✍️ How many declarations (property: value pairs) are in this rule?
    h1 {
      padding: 8px;
      font-weight: bold;
      margin: 10px;
    }
  21. 21.✍️ Which property is set to 2px solid in this rule?
    .note {
      font-weight: bold;
      border: 2px solid;
    }
    (a) 2px solid (b) width (c) border (d) font-style
  22. 22.✍️ Which property is set to bold in this rule?
    h1 {
      font-weight: bold;
      background-color: yellow;
    }
    (a) width (b) bold (c) border (d) font-weight
  23. 23.True or false: .note is an id selector. (a) False (b) True
  24. 24.🎯 Which CSS selector matches this element?
    <span class="menu" id="top">Hello</span>
    (a) #intro (b) .menu (c) #menu (d) .top
  25. 25.📱 min-width: 800px applies when the screen is ___. (a) exactly 100px (b) turned off (c) 800px or wider (d) 800px or narrower
  26. 26.🎯 Which element does the selector .big style? (a) <li class="box"> (b) <h2 class="big"> (c) <h2 id="big"> (d) <h2 class="red">
  27. 27.📱 Responsive design means a page ___. (a) has no pictures (b) fits every screen (c) never changes (d) is only for laptops
  28. 28.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 160px;
      justify-content: space-between;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  29. 29.🧩 Which language checks a quiz answer? (a) CSS (b) JavaScript (c) HTML
  30. 30.⚖️ What colour is the text of this element?
    <h2 class="red" id="hero">Hi</h2>
    CSS:
    h2 { color: purple; }
    h2 { color: orange; }
    (a) purple (b) yellow (c) orange (d) blue
  31. 31.🎨 One CSS file can style how many pages? (a) many pages (b) only one word (c) only one image (d) no pages
  32. 32.✍️ How many declarations (property: value pairs) are in this rule?
    body {
      color: red;
      margin: 10px;
      padding: 8px;
      text-align: center;
    }
  33. 33.💪 Which flexbox property lines boxes up across? (a) gap (b) align-items (c) flex-direction (d) display: flex
  34. 34.Which of these does CSS do? (a) changes the page live (b) counts down a timer (c) shows a pop-up message (d) sets colours and fonts
  35. 35.Which of these does JavaScript do? (a) gives the page structure (b) shows a pop-up message (c) rounds box corners (d) changes the text size
  36. 36.📱 What does a media query check? (a) the time of day (b) the page title (c) the battery level (d) the screen width
  37. 37.🎨 Which tag connects an outside CSS file? (a) <css> (b) <a> (c) <img> (d) <link>
  38. 38.What does color do? (a) makes letters bigger (b) makes the text bold (c) colours behind the text (d) sets the letter colour
  39. 39.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 18px;
      }
    }
  40. 40.🧩 Which language puts a picture on a page? (a) HTML (b) JavaScript (c) CSS

Answer key

  1. the text or picture
  2. a class selector
  3. No
  4. 24
  5. the line round the box
  6. 320
  7. No
  8. #
  9. 600px or narrower
  10. border
  11. 60
  12. 16
  13. an id selector
  14. a class selector
  15. False
  16. blue
  17. orange
  18. 192
  19. 1
  20. 3
  21. border
  22. font-weight
  23. False
  24. .menu
  25. 800px or wider
  26. <h2 class="big">
  27. fits every screen
  28. 80
  29. JavaScript
  30. orange
  31. many pages
  32. 4
  33. align-items
  34. sets colours and fonts
  35. shows a pop-up message
  36. the screen width
  37. <link>
  38. sets the letter colour
  39. 24
  40. HTML

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