← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 164 · 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 #ffffff? (a) magenta (b) bright green (c) black (d) white
  2. 2.📱 The screen is 375px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 18px;
      }
    }
    (a) No (b) Yes
  3. 3.✍️ Which sign goes between a property and its value? (a) ; (b) = (c) : (d) -
  4. 4.💪 Which flexbox property picks row or column? (a) justify-content (b) flex-direction (c) display: flex (d) gap
  5. 5.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 240px;
      justify-content: center;
    }
    Inside are 2 boxes, each 50px wide (no margins).
  6. 6.🧩 Which language gives the page structure? (a) JavaScript (b) HTML (c) CSS
  7. 7.True or false: JavaScript lays out the page. (a) False (b) True
  8. 8.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 110px;
      padding: 5px;
      border: 1px solid black;
      margin: 0px;
    }
  9. 9.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 210px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 50px wide (no margins).
  10. 10.🖌️ What colour are the letters?
    li {
      color: white;
      font-size: 20px;
      background-color: yellow;
      text-align: center;
    }
    (a) white (b) yellow (c) green
  11. 11.🧩 Which language checks a quiz answer? (a) CSS (b) JavaScript (c) HTML
  12. 12.🎯 Which element does the selector #end style? (a) <div class="menu"> (b) <li id="hero"> (c) <li class="end"> (d) <li id="end">
  13. 13.🎯 Can many elements share the same class? (a) No (b) Yes
  14. 14.⚖️ Which selector is the weakest? (a) an id selector (b) a class selector (c) an element selector
  15. 15.✍️ Which sign ends each CSS declaration? (a) : (b) . (c) ; (d) ,
  16. 16.Which of these is padding? (a) the text or picture (b) space outside the border (c) space inside the border (d) the gap to other boxes
  17. 17.⚖️ What colour is the text of this element?
    <p class="box" id="hero">Hi</p>
    CSS:
    p { color: white; }
    #hero { color: red; }
    .box { color: orange; }
    (a) white (b) orange (c) red (d) black
  18. 18.🔍 Which is the odd one out? (a) gives the page structure (b) sets colours and fonts (c) makes a form box (d) puts a picture on a page
  19. 19.📱 What does a media query check? (a) the screen width (b) the battery level (c) the time of day (d) the page title
  20. 20.⚖️ What colour is the text of this element?
    <h2 class="menu" id="intro">Hi</h2>
    CSS:
    h2 { color: black; }
    h2 { color: red; }
    (a) blue (b) red (c) orange (d) black
  21. 21.⚖️ What colour is the text of this element?
    <p class="star" id="intro">Hi</p>
    CSS:
    .star { color: yellow; }
    #intro { color: blue; }
    p { color: green; }
    (a) orange (b) green (c) blue (d) yellow
  22. 22.🔍 Which is the odd one out? (a) counts down a timer (b) shows a pop-up message (c) rounds box corners (d) reacts to a button click
  23. 23.What does color do? (a) colours behind the text (b) centres a heading (c) sets the letter colour (d) makes the text bold
  24. 24.🎨 Which tag connects an outside CSS file? (a) <img> (b) <a> (c) <link> (d) <css>
  25. 25.🖌️ What colour are the letters?
    h1 {
      text-align: left;
      color: blue;
      font-size: 20px;
      background-color: orange;
    }
    (a) green (b) orange (c) blue
  26. 26.🌈 Which colour of light is strongest in rgb(41, 116, 217)? (a) green (b) blue (c) red
  27. 27.🎯 Which element does the selector .red style? (a) <h2 class="star"> (b) <h1 class="red"> (c) <h1 id="red"> (d) <h1 class="box">
  28. 28.What does justify-content: center do? (a) packs boxes at the end (b) packs boxes at the start (c) equal gaps, none at ends (d) puts boxes in the middle
  29. 29.🌈 What is the biggest number one colour can have in rgb()? (a) 99 (b) 255 (c) 1000 (d) 100
  30. 30.🎨 One CSS file can style how many pages? (a) only one image (b) many pages (c) only one word (d) no pages
  31. 31.📦 In the box model, which part is the line round the box? (a) margin (b) padding (c) content (d) border
  32. 32.🎯 What kind of selector is #hero? (a) a class selector (b) an id selector (c) an element selector
  33. 33.📱 min-width: 800px applies when the screen is ___. (a) turned off (b) exactly 100px (c) 800px or narrower (d) 800px or wider
  34. 34.📦 In the box model, which part is space inside the border? (a) content (b) border (c) padding (d) margin
  35. 35.What does text-align do? (a) centres a heading (b) picks the font style (c) makes the text bold (d) makes letters bigger
  36. 36.📦 In the box model, which part is space outside the border? (a) content (b) margin (c) border (d) padding
  37. 37.✍️ What value is given to padding in this rule?
    h2 {
      padding: 8px;
      width: 300px;
    }
    (a) 8px (b) bold (c) padding (d) 2px solid
  38. 38.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 1024px) {
      p {
        font-size: 30px;
      }
    }
    (a) Yes (b) No
  39. 39.🖌️ Which CSS property makes letters bigger? (a) background-color (b) font-size (c) font-family (d) color
  40. 40.🖌️ Where does the text sit on its line?
    h2 {
      font-size: 12px;
      background-color: blue;
      text-align: right;
      color: orange;
    }
    (a) on the left (b) in the middle (c) on the right

Answer key

  1. white
  2. No
  3. :
  4. flex-direction
  5. 70
  6. HTML
  7. False
  8. 122
  9. 10
  10. white
  11. JavaScript
  12. <li id="end">
  13. Yes
  14. an element selector
  15. ;
  16. space inside the border
  17. red
  18. sets colours and fonts
  19. the screen width
  20. red
  21. blue
  22. rounds box corners
  23. sets the letter colour
  24. <link>
  25. blue
  26. blue
  27. <h1 class="red">
  28. puts boxes in the middle
  29. 255
  30. many pages
  31. border
  32. an id selector
  33. 800px or wider
  34. padding
  35. centres a heading
  36. margin
  37. 8px
  38. No
  39. font-size
  40. on the right

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