← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 976 · 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.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      padding: 8px;
      font-size: 20px;
      border: 2px solid;
    }
  2. 2.🎯 How many elements on a page should have the same id? (a) 2 (b) any number (c) 1 (d) 5
  3. 3.🎯 What kind of selector is #top? (a) an id selector (b) an element selector (c) a class selector
  4. 4.🖌️ How big is the text, in px?
    h2 {
      font-size: 36px;
      text-align: right;
      background-color: orange;
      color: white;
    }
  5. 5.🔍 Which is the odd one out? (a) gives the page structure (b) reacts to a button click (c) puts a picture on a page (d) makes headings and lists
  6. 6.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 140px;
      justify-content: flex-end;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  7. 7.✍️ In color: blue; which part is the value? (a) : (b) ; (c) blue (d) color
  8. 8.🖌️ Which CSS property makes letters bigger? (a) font-family (b) background-color (c) font-size (d) color
  9. 9.🎨 What does CSS stand for? (a) Computer Style Sheets (b) Creative Sheet System (c) Colourful Site Styles (d) Cascading Style Sheets
  10. 10.🧩 Which language reacts to a button click? (a) HTML (b) JavaScript (c) CSS
  11. 11.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 30px;
      }
    }
    (a) Yes (b) No
  12. 12.⚖️ What colour is the text of this element?
    <h2 class="star" id="intro">Hi</h2>
    CSS:
    #intro { color: orange; }
    #intro { color: purple; }
    (a) orange (b) purple (c) black (d) yellow
  13. 13.Which of these does JavaScript do? (a) adds space around boxes (b) gives the page structure (c) puts a picture on a page (d) changes the page live
  14. 14.⚖️ What colour is the text of this element?
    <h2 class="box" id="top">Hi</h2>
    CSS:
    #top { color: black; }
    h2 { color: purple; }
    (a) purple (b) orange (c) white (d) black
  15. 15.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 350px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 100px wide (no margins).
  16. 16.✍️ What is the selector in this CSS rule?
    #top {
      text-align: center;
      font-size: 20px;
    }
    (a) 20px (b) text-align (c) li (d) #top
  17. 17.✍️ What is the selector in this CSS rule?
    h1 {
      text-align: center;
      font-style: italic;
    }
    (a) text-align (b) h1 (c) italic (d) p
  18. 18.🧩 Which language makes headings and lists? (a) HTML (b) JavaScript (c) CSS
  19. 19.🌈 Which colour of light is strongest in rgb(30, 36, 208)? (a) blue (b) green (c) red
  20. 20.📱 Which tag helps phones show a page at the right size? (a) the viewport meta tag (b) the hr tag (c) the br tag (d) the title tag
  21. 21.⚖️ Which selector is the weakest? (a) an element selector (b) a class selector (c) an id selector
  22. 22.⚖️ What colour is the text of this element?
    <p class="box" id="logo">Hi</p>
    CSS:
    p { color: purple; }
    p { color: orange; }
    (a) black (b) orange (c) red (d) purple
  23. 23.✍️ Which sign ends each CSS declaration? (a) . (b) , (c) : (d) ;
  24. 24.🖌️ What colour is behind the letters?
    h1 {
      text-align: center;
      font-size: 40px;
      background-color: red;
      color: yellow;
    }
    (a) red (b) black (c) yellow
  25. 25.Which of these is padding? (a) the line round the box (b) space outside the border (c) a solid or dotted edge (d) space inside the border
  26. 26.📱 What does a media query check? (a) the time of day (b) the battery level (c) the screen width (d) the page title
  27. 27.🎯 What kind of selector is .big? (a) an element selector (b) an id selector (c) a class selector
  28. 28.💪 Which justify-content value packs boxes at the end? (a) space-between (b) center (c) flex-end (d) flex-start
  29. 29.✍️ CSS declarations go inside which brackets? (a) < > (b) ( ) (c) [ ] (d) { }
  30. 30.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 60px;
      padding: 10px;
      border: 2px solid black;
      margin: 15px;
    }
  31. 31.🔍 Which is the odd one out? (a) makes a form box (b) gives the page structure (c) makes a link (d) shows a pop-up message
  32. 32.🎯 Which sign starts a class selector? (a) @ (b) . (c) & (d) #
  33. 33.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      background-color: yellow;
      font-style: italic;
      border: 2px solid;
    }
  34. 34.🖌️ Where does the text sit on its line?
    li {
      background-color: yellow;
      text-align: right;
      color: green;
      font-size: 16px;
    }
    (a) on the right (b) in the middle (c) on the left
  35. 35.What does justify-content: flex-start do? (a) equal gaps, none at ends (b) puts boxes in the middle (c) packs boxes at the end (d) packs boxes at the start
  36. 36.🔍 Which is the odd one out? (a) makes a link (b) puts a picture on a page (c) makes headings and lists (d) sets colours and fonts
  37. 37.📱 The screen is 1366px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 18px;
      }
    }
  38. 38.🎯 Which element does the selector #main style? (a) <h1 class="main"> (b) <h2 class="menu"> (c) <h1 id="logo"> (d) <h1 id="main">
  39. 39.🔍 Which is the odd one out? (a) counts down a timer (b) rounds box corners (c) shows a pop-up message (d) reacts to a button click
  40. 40.Which of these does HTML do? (a) changes the text size (b) changes the page live (c) makes headings and lists (d) checks a quiz answer

Answer key

  1. 3
  2. 1
  3. an id selector
  4. 36
  5. reacts to a button click
  6. 40
  7. blue
  8. font-size
  9. Cascading Style Sheets
  10. JavaScript
  11. Yes
  12. purple
  13. changes the page live
  14. black
  15. 50
  16. #top
  17. h1
  18. HTML
  19. blue
  20. the viewport meta tag
  21. an element selector
  22. orange
  23. ;
  24. red
  25. space inside the border
  26. the screen width
  27. a class selector
  28. flex-end
  29. { }
  30. 84
  31. shows a pop-up message
  32. .
  33. 3
  34. on the right
  35. packs boxes at the start
  36. sets colours and fonts
  37. 18
  38. <h1 id="main">
  39. rounds box corners
  40. makes headings and lists

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