← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 426 · 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 sign ends each CSS declaration? (a) : (b) , (c) . (d) ;
  2. 2.🌈 In #00aa00 the green part is the hex number aa. What is it as a normal number?
  3. 3.💪 Which flexbox property sets space between boxes? (a) justify-content (b) gap (c) align-items (d) flex-direction
  4. 4.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 130px;
      padding: 15px;
      border: 1px solid black;
      margin: 5px;
    }
  5. 5.🎯 Which CSS selector matches this element?
    <h1 class="box" id="top">Hello</h1>
    (a) .top (b) #intro (c) h2 (d) .box
  6. 6.⚖️ What colour is the text of this element?
    <h1 class="menu" id="logo">Hi</h1>
    CSS:
    .menu { color: purple; }
    #logo { color: yellow; }
    h1 { color: green; }
    (a) purple (b) green (c) yellow (d) white
  7. 7.💪 Which justify-content value packs boxes at the start? (a) flex-start (b) center (c) space-between (d) flex-end
  8. 8.✍️ How many declarations (property: value pairs) are in this rule?
    h2 {
      padding: 8px;
      font-size: 20px;
      text-align: center;
      color: red;
    }
  9. 9.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 110px;
      padding: 15px;
      border: 2px solid black;
      margin: 15px;
    }
  10. 10.🧩 Which language changes the page live? (a) HTML (b) CSS (c) JavaScript
  11. 11.Which of these is padding? (a) a solid or dotted edge (b) the gap round content (c) the gap to other boxes (d) space outside the border
  12. 12.📱 min-width: 800px applies when the screen is ___. (a) 800px or narrower (b) exactly 100px (c) turned off (d) 800px or wider
  13. 13.📱 What does a media query check? (a) the page title (b) the screen width (c) the time of day (d) the battery level
  14. 14.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 200px;
      justify-content: flex-end;
    }
    Inside are 3 boxes, each 40px wide (no margins).
  15. 15.🌈 How many pairs of hex digits are in a colour like #ff8800? (a) 2 (b) 6 (c) 3 (d) 4
  16. 16.✍️ What value is given to font-style in this rule?
    p {
      font-style: italic;
      color: red;
      border: 2px solid;
    }
    (a) font-style (b) red (c) 20px (d) italic
  17. 17.What does color do? (a) sets the letter colour (b) makes the text bold (c) makes letters bigger (d) centres a heading
  18. 18.🌈 Which colour is rgb(0, 255, 0)? (a) red (b) bright green (c) blue (d) cyan
  19. 19.🧩 Which language counts down a timer? (a) JavaScript (b) HTML (c) CSS
  20. 20.🌈 What is the biggest number one colour can have in rgb()? (a) 1000 (b) 100 (c) 99 (d) 255
  21. 21.✍️ What value is given to text-align in this rule?
    h2 {
      font-weight: bold;
      padding: 8px;
      font-style: italic;
      text-align: center;
    }
    (a) 10px (b) yellow (c) text-align (d) center
  22. 22.📱 The screen is 1100px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 12px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 14px;
      }
    }
  23. 23.True or false: the content is the text or picture. (a) True (b) False
  24. 24.🎯 Which element does the selector p style? (a) <p class="big"> (b) <h2 class="big"> (c) <h1> (d) <li id="logo">
  25. 25.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 24px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 26px;
      }
    }
  26. 26.✍️ How many declarations (property: value pairs) are in this rule?
    .box {
      text-align: center;
      background-color: yellow;
    }
  27. 27.🖌️ Where does the text sit on its line?
    h1 {
      background-color: purple;
      color: yellow;
      text-align: left;
      font-size: 24px;
    }
    (a) on the right (b) on the left (c) in the middle
  28. 28.🌈 Which colour is #ffffff? (a) yellow (b) magenta (c) white (d) bright green
  29. 29.⚖️ What colour is the text of this element?
    <h1 class="note" id="main">Hi</h1>
    CSS:
    .note { color: orange; }
    .note { color: purple; }
    (a) orange (b) purple (c) blue (d) yellow
  30. 30.✍️ What value is given to font-weight in this rule?
    body {
      margin: 10px;
      font-style: italic;
      font-weight: bold;
      color: red;
    }
    (a) 2px solid (b) bold (c) font-weight (d) 300px
  31. 31.⚖️ What colour is the text of this element?
    <h1 class="note" id="end">Hi</h1>
    CSS:
    h1 { color: orange; }
    .note { color: green; }
    #end { color: white; }
    (a) green (b) orange (c) blue (d) white
  32. 32.🌈 In #ad0000 the red part is the hex number ad. What is it as a normal number?
  33. 33.⚖️ What colour is the text of this element?
    <h2 class="note" id="logo">Hi</h2>
    CSS:
    .note { color: orange; }
    .note { color: red; }
    (a) orange (b) black (c) purple (d) red
  34. 34.⚖️ What colour is the text of this element?
    <p class="big" id="end">Hi</p>
    CSS:
    p { color: white; }
    #end { color: yellow; }
    (a) red (b) orange (c) yellow (d) white
  35. 35.True or false: CSS reacts to a button click. (a) True (b) False
  36. 36.✍️ How does a CSS comment start? (a) # (b) /* (c) <!-- (d) //
  37. 37.💪 Which flexbox property lines boxes up across? (a) justify-content (b) align-items (c) display: flex (d) gap
  38. 38.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 480px;
      justify-content: flex-start;
    }
    Inside are 4 boxes, each 100px wide (no margins).
  39. 39.🌈 In #960000 the red part is the hex number 96. What is it as a normal number?
  40. 40.🧩 Which language makes headings and lists? (a) HTML (b) CSS (c) JavaScript

Answer key

  1. ;
  2. 170
  3. gap
  4. 172
  5. .box
  6. yellow
  7. flex-start
  8. 4
  9. 174
  10. JavaScript
  11. the gap round content
  12. 800px or wider
  13. the screen width
  14. 80
  15. 3
  16. italic
  17. sets the letter colour
  18. bright green
  19. JavaScript
  20. 255
  21. center
  22. 14
  23. True
  24. <p class="big">
  25. 24
  26. 2
  27. on the left
  28. white
  29. purple
  30. bold
  31. white
  32. 173
  33. red
  34. yellow
  35. False
  36. /*
  37. align-items
  38. 80
  39. 150
  40. HTML

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