← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 329 · 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.📱 max-width: 600px applies when the screen is ___. (a) 600px or narrower (b) exactly 1000px (c) turned off (d) 600px or wider
  2. 2.🎨 One CSS file can style how many pages? (a) only one word (b) no pages (c) only one image (d) many pages
  3. 3.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the first one (b) the later one (c) the shorter one (d) neither
  4. 4.✍️ Which sign ends each CSS declaration? (a) ; (b) : (c) . (d) ,
  5. 5.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 150px;
      padding: 20px;
      border: 1px solid black;
      margin: 0px;
    }
  6. 6.True or false: HTML adds space around boxes. (a) True (b) False
  7. 7.✍️ CSS declarations go inside which brackets? (a) { } (b) [ ] (c) < > (d) ( )
  8. 8.🌈 Which colour is rgb(0, 255, 255)? (a) bright green (b) cyan (c) red (d) yellow
  9. 9.✍️ Which property is set to center in this rule?
    .box {
      color: red;
      text-align: center;
    }
    (a) center (b) margin (c) background-color (d) text-align
  10. 10.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 200px;
      padding: 15px;
      border: 2px solid black;
      margin: 15px;
    }
  11. 11.🖌️ How big is the text, in px?
    li {
      text-align: right;
      background-color: purple;
      font-size: 16px;
      color: black;
    }
  12. 12.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 130px;
      justify-content: flex-start;
    }
    Inside are 2 boxes, each 40px wide (no margins).
  13. 13.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 300px;
      justify-content: center;
    }
    Inside are 2 boxes, each 100px wide (no margins).
  14. 14.What does justify-content: flex-start do? (a) packs boxes at the end (b) puts boxes in the middle (c) packs boxes at the start (d) equal gaps, none at ends
  15. 15.⚖️ What colour is the text of this element?
    <h2 class="note" id="hero">Hi</h2>
    CSS:
    #hero { color: orange; }
    h2 { color: purple; }
    (a) purple (b) green (c) blue (d) orange
  16. 16.True or false: img is a class selector. (a) False (b) True
  17. 17.🌈 In #b00000 the red part is the hex number b0. What is it as a normal number?
  18. 18.🖌️ How big is the text, in px?
    h2 {
      font-size: 12px;
      background-color: blue;
      color: yellow;
      text-align: left;
    }
  19. 19.True or false: the content is the line round the box. (a) False (b) True
  20. 20.🌈 Which colour is rgb(0, 0, 255)? (a) black (b) red (c) blue (d) white
  21. 21.🌈 Hex digits go 0 to 9, then A to which letter? (a) Z (b) F (c) J (d) G
  22. 22.🌈 Which colour of light is strongest in rgb(132, 21, 219)? (a) red (b) green (c) blue
  23. 23.🌈 What is the biggest number one colour can have in rgb()? (a) 100 (b) 1000 (c) 99 (d) 255
  24. 24.⚖️ Which selector is the weakest? (a) an id selector (b) a class selector (c) an element selector
  25. 25.⚖️ Which selector is the strongest? (a) an id selector (b) an element selector (c) a class selector
  26. 26.✍️ What is the selector in this CSS rule?
    h1 {
      color: red;
      background-color: yellow;
    }
    (a) yellow (b) color (c) h1 (d) p
  27. 27.🧩 Which language adds space around boxes? (a) JavaScript (b) HTML (c) CSS
  28. 28.🌈 Which hex code is magenta? (a) #ffff00 (b) #00ff00 (c) #ff00ff (d) #000000
  29. 29.True or false: JavaScript changes the text size. (a) True (b) False
  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: 280px;
      padding: 10px;
      border: 1px solid black;
      margin: 0px;
    }
  31. 31.What does background-color do? (a) makes the text bold (b) makes letters bigger (c) picks the font style (d) colours behind the text
  32. 32.🖌️ Which CSS property sets the letter colour? (a) font-weight (b) font-family (c) text-align (d) color
  33. 33.🖌️ Where does the text sit on its line?
    p {
      text-align: center;
      font-size: 12px;
      background-color: purple;
      color: white;
    }
    (a) on the left (b) in the middle (c) on the right
  34. 34.✍️ What value is given to padding in this rule?
    h2 {
      padding: 8px;
      width: 300px;
    }
    (a) bold (b) 8px (c) 2px solid (d) padding
  35. 35.🌈 Which colour is #ffff00? (a) bright green (b) blue (c) yellow (d) red
  36. 36.🌈 In #00b300 the green part is the hex number b3. What is it as a normal number?
  37. 37.✍️ What is the selector in this CSS rule?
    .note {
      font-size: 20px;
      background-color: yellow;
      text-align: center;
      font-style: italic;
    }
    (a) font-size (b) #top (c) yellow (d) .note
  38. 38.⚖️ What colour is the text of this element?
    <p class="box" id="logo">Hi</p>
    CSS:
    p { color: green; }
    #logo { color: blue; }
    .box { color: black; }
    (a) black (b) green (c) blue (d) orange
  39. 39.📱 What does a media query check? (a) the time of day (b) the screen width (c) the battery level (d) the page title
  40. 40.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 16px;
    }
    @media (min-width: 768px) {
      p {
        font-size: 18px;
      }
    }
    (a) No (b) Yes

Answer key

  1. 600px or narrower
  2. many pages
  3. the later one
  4. ;
  5. 192
  6. False
  7. { }
  8. cyan
  9. text-align
  10. 264
  11. 16
  12. 50
  13. 50
  14. packs boxes at the start
  15. orange
  16. False
  17. 176
  18. 12
  19. False
  20. blue
  21. F
  22. blue
  23. 255
  24. an element selector
  25. an id selector
  26. h1
  27. CSS
  28. #ff00ff
  29. False
  30. 302
  31. colours behind the text
  32. color
  33. in the middle
  34. 8px
  35. yellow
  36. 179
  37. .note
  38. blue
  39. the screen width
  40. No

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