← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 572 · 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 justify-content value packs boxes at the end? (a) flex-end (b) space-between (c) center (d) flex-start
  2. 2.⚖️ What colour is the text of this element?
    <h1 class="menu" id="main">Hi</h1>
    CSS:
    .menu { color: purple; }
    .menu { color: red; }
    (a) purple (b) white (c) green (d) red
  3. 3.✍️ What is the selector in this CSS rule?
    #top {
      width: 300px;
      background-color: yellow;
      color: red;
      font-size: 20px;
    }
    (a) #top (b) li (c) width (d) yellow
  4. 4.🧩 Which language makes a form box? (a) JavaScript (b) CSS (c) HTML
  5. 5.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      font-style: italic;
    }
  6. 6.📱 What does a media query check? (a) the page title (b) the time of day (c) the screen width (d) the battery level
  7. 7.🌈 Which colour of light is strongest in rgb(56, 42, 170)? (a) blue (b) red (c) green
  8. 8.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) exactly 100px (c) 800px or wider (d) turned off
  9. 9.⚖️ What colour is the text of this element?
    <p class="box" id="hero">Hi</p>
    CSS:
    p { color: purple; }
    p { color: red; }
    (a) yellow (b) red (c) green (d) purple
  10. 10.🎨 Which tag connects an outside CSS file? (a) <css> (b) <link> (c) <a> (d) <img>
  11. 11.🌈 Which colour is rgb(0, 255, 0)? (a) magenta (b) red (c) bright green (d) cyan
  12. 12.✍️ What value is given to color in this rule?
    .box {
      color: red;
      margin: 10px;
    }
    (a) color (b) center (c) red (d) 20px
  13. 13.⚖️ What colour is the text of this element?
    <p class="box" id="intro">Hi</p>
    CSS:
    .box { color: red; }
    .box { color: white; }
    (a) purple (b) black (c) white (d) red
  14. 14.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 150px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  15. 15.🖌️ How big is the text, in px?
    p {
      font-size: 16px;
      background-color: yellow;
      color: green;
      text-align: right;
    }
  16. 16.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 130px;
      padding: 15px;
      border: 3px solid black;
      margin: 5px;
    }
  17. 17.📦 In the box model, which part is the gap round content? (a) content (b) padding (c) border (d) margin
  18. 18.✍️ Which property is set to italic in this rule?
    .note {
      font-size: 20px;
      font-style: italic;
      padding: 8px;
      font-weight: bold;
    }
    (a) font-size (b) font-style (c) color (d) italic
  19. 19.📦 In the box model, which part is space inside the border? (a) content (b) border (c) margin (d) padding
  20. 20.✍️ What is the selector in this CSS rule?
    #top {
      font-size: 20px;
      padding: 8px;
      background-color: yellow;
      margin: 10px;
    }
    (a) li (b) font-size (c) 8px (d) #top
  21. 21.✍️ In color: blue; which part is the value? (a) blue (b) ; (c) : (d) color
  22. 22.✍️ In color: blue; which part is the property? (a) : (b) blue (c) color (d) ;
  23. 23.🎯 How many elements on a page should have the same id? (a) any number (b) 1 (c) 5 (d) 2
  24. 24.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 270px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 60px wide (no margins).
  25. 25.💪 Which flexbox property spaces boxes along a row? (a) flex-direction (b) display: flex (c) align-items (d) justify-content
  26. 26.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 20px;
      }
    }
  27. 27.🎯 What kind of selector is body? (a) an id selector (b) a class selector (c) an element selector
  28. 28.🧩 Which language makes headings and lists? (a) HTML (b) CSS (c) JavaScript
  29. 29.True or false: HTML makes a form box. (a) False (b) True
  30. 30.✍️ How many declarations (property: value pairs) are in this rule?
    li {
      font-size: 20px;
      font-weight: bold;
      border: 2px solid;
      width: 300px;
    }
  31. 31.🧩 Which language lays out the page? (a) HTML (b) JavaScript (c) CSS
  32. 32.⚖️ What colour is the text of this element?
    <h1 class="star" id="intro">Hi</h1>
    CSS:
    .star { color: black; }
    #intro { color: blue; }
    h1 { color: green; }
    (a) red (b) green (c) black (d) blue
  33. 33.📦 In the box model, which part is the text or picture? (a) margin (b) border (c) content (d) padding
  34. 34.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 320px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 100px wide (no margins).
  35. 35.🌈 Which colour is #00ff00? (a) bright green (b) red (c) cyan (d) yellow
  36. 36.🖌️ Where does the text sit on its line?
    h1 {
      font-size: 24px;
      color: orange;
      text-align: left;
      background-color: green;
    }
    (a) on the left (b) on the right (c) in the middle
  37. 37.🌈 In #c00000 the red part is the hex number c0. What is it as a normal number?
  38. 38.✍️ Which sign goes between a property and its value? (a) : (b) = (c) - (d) ;
  39. 39.🧩 Which language puts a picture on a page? (a) HTML (b) JavaScript (c) CSS
  40. 40.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 140px;
      justify-content: flex-end;
    }
    Inside are 3 boxes, each 40px wide (no margins).

Answer key

  1. flex-end
  2. red
  3. #top
  4. HTML
  5. 1
  6. the screen width
  7. blue
  8. 800px or wider
  9. red
  10. <link>
  11. bright green
  12. red
  13. white
  14. 70
  15. 16
  16. 166
  17. padding
  18. font-style
  19. padding
  20. #top
  21. blue
  22. color
  23. 1
  24. 30
  25. justify-content
  26. 16
  27. an element selector
  28. HTML
  29. True
  30. 4
  31. CSS
  32. blue
  33. content
  34. 20
  35. bright green
  36. on the left
  37. 192
  38. :
  39. HTML
  40. 20

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