← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 945 · 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 rgb(255, 255, 255)? (a) cyan (b) yellow (c) white (d) red
  2. 2.🧩 Which language makes headings and lists? (a) CSS (b) JavaScript (c) HTML
  3. 3.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
  4. 4.True or false: the border is the line round the box. (a) True (b) False
  5. 5.🖌️ What colour are the letters?
    h1 {
      text-align: left;
      background-color: white;
      font-size: 40px;
      color: blue;
    }
    (a) white (b) black (c) blue
  6. 6.⚖️ What colour is the text of this element?
    <h1 class="big" id="hero">Hi</h1>
    CSS:
    .big { color: green; }
    h1 { color: white; }
    (a) green (b) white (c) black (d) orange
  7. 7.🔍 Which is the odd one out? (a) makes headings and lists (b) adds space around boxes (c) makes a form box (d) makes a link
  8. 8.📦 How much space across (px) does this box take in all, margin included?
    .box {
      width: 130px;
      padding: 20px;
      border: 3px solid black;
      margin: 5px;
    }
  9. 9.True or false: #hero is an element selector. (a) True (b) False
  10. 10.✍️ In color: blue; which part is the value? (a) blue (b) color (c) ; (d) :
  11. 11.💪 How much empty space (px) is left after the last box?
    .row {
      display: flex;
      width: 160px;
      justify-content: flex-start;
    }
    Inside are 3 boxes, each 40px wide (no margins).
  12. 12.🖌️ How big is the text, in px?
    li {
      background-color: purple;
      text-align: left;
      color: orange;
      font-size: 32px;
    }
  13. 13.📱 The screen is 700px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 480px) {
      p {
        font-size: 26px;
      }
    }
    (a) No (b) Yes
  14. 14.🎯 Which element does the selector li style? (a) <span class="menu"> (b) <li class="menu"> (c) <p id="top"> (d) <div>
  15. 15.🌈 In #640000 the red part is the hex number 64. What is it as a normal number?
  16. 16.True or false: .card is an id selector. (a) True (b) False
  17. 17.📱 The screen is 1366px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 20px;
      }
    }
    (a) No (b) Yes
  18. 18.📱 The screen is 820px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 18px;
      }
    }
  19. 19.📱 The screen is 320px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 20px;
    }
    @media (max-width: 480px) {
      p {
        font-size: 16px;
      }
    }
  20. 20.✍️ What value is given to padding in this rule?
    li {
      text-align: center;
      color: red;
      border: 2px solid;
      padding: 8px;
    }
    (a) bold (b) 2px solid (c) padding (d) 8px
  21. 21.📱 The screen is 540px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 10px;
      }
    }
  22. 22.✍️ In color: blue; which part is the property? (a) blue (b) : (c) color (d) ;
  23. 23.⚖️ What colour is the text of this element?
    <h2 class="star" id="logo">Hi</h2>
    CSS:
    h2 { color: blue; }
    h2 { color: purple; }
    (a) blue (b) purple (c) orange (d) yellow
  24. 24.🎯 Which element does the selector #intro style? (a) <div id="main"> (b) <div class="intro"> (c) <span class="menu"> (d) <div id="intro">
  25. 25.💪 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).
  26. 26.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 50px;
      padding: 15px;
      border: 3px solid black;
      margin: 15px;
    }
  27. 27.🎨 Which attribute adds CSS inside one tag? (a) alt (b) style (c) href (d) src
  28. 28.💪 Which flexbox property picks row or column? (a) gap (b) display: flex (c) justify-content (d) flex-direction
  29. 29.📱 What does a media query check? (a) the battery level (b) the screen width (c) the page title (d) the time of day
  30. 30.📱 Which tag helps phones show a page at the right size? (a) the br tag (b) the viewport meta tag (c) the hr tag (d) the title tag
  31. 31.True or false: HTML sets colours and fonts. (a) False (b) True
  32. 32.✍️ Which sign ends each CSS declaration? (a) ; (b) , (c) . (d) :
  33. 33.⚖️ What colour is the text of this element?
    <h2 class="note" id="logo">Hi</h2>
    CSS:
    #logo { color: white; }
    h2 { color: green; }
    (a) black (b) green (c) purple (d) white
  34. 34.🧩 Which language rounds box corners? (a) CSS (b) JavaScript (c) HTML
  35. 35.🎨 Which tag connects an outside CSS file? (a) <img> (b) <a> (c) <css> (d) <link>
  36. 36.🌈 Which colour is #00ffff? (a) red (b) cyan (c) magenta (d) yellow
  37. 37.Which of these does JavaScript do? (a) puts a picture on a page (b) changes the page live (c) sets colours and fonts (d) lays out the page
  38. 38.🌈 Hex digits go 0 to 9, then A to which letter? (a) Z (b) F (c) J (d) G
  39. 39.🎯 Which element does the selector .menu style? (a) <h2 class="big"> (b) <h1 class="menu"> (c) <h1 id="menu"> (d) <h1 class="note">
  40. 40.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 240px;
      justify-content: flex-end;
    }
    Inside are 4 boxes, each 50px wide (no margins).

Answer key

  1. white
  2. HTML
  3. packs boxes at the start
  4. True
  5. blue
  6. green
  7. adds space around boxes
  8. 186
  9. False
  10. blue
  11. 40
  12. 32
  13. Yes
  14. <li class="menu">
  15. 100
  16. False
  17. Yes
  18. 20
  19. 16
  20. 8px
  21. 10
  22. color
  23. purple
  24. <div id="intro">
  25. 50
  26. 116
  27. style
  28. flex-direction
  29. the screen width
  30. the viewport meta tag
  31. False
  32. ;
  33. white
  34. CSS
  35. <link>
  36. cyan
  37. changes the page live
  38. F
  39. <h1 class="menu">
  40. 40

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