← CSS test lesson New set →

CSS Worksheet: Practice Test

HTML and CSS lesson 20: CSS test · Set 187 · 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.True or false: HTML adds space around boxes. (a) False (b) True
  2. 2.🌈 Which colour is #0000ff? (a) bright green (b) blue (c) black (d) red
  3. 3.🎯 Which CSS selector matches this element?
    <h1 class="red" id="intro">Hello</h1>
    (a) h1 (b) #main (c) #red (d) h2
  4. 4.⚖️ What colour is the text of this element?
    <h2 class="box" id="top">Hi</h2>
    CSS:
    h2 { color: black; }
    #top { color: orange; }
    .box { color: red; }
    (a) red (b) orange (c) black (d) purple
  5. 5.📱 The screen is 320px wide. Does the rule inside @media apply?
    p {
      font-size: 12px;
    }
    @media (max-width: 600px) {
      p {
        font-size: 8px;
      }
    }
    (a) No (b) Yes
  6. 6.🖌️ Where does the text sit on its line?
    h1 {
      text-align: left;
      color: blue;
      background-color: purple;
      font-size: 24px;
    }
    (a) in the middle (b) on the right (c) on the left
  7. 7.True or false: HTML makes a form box. (a) False (b) True
  8. 8.⚖️ What colour is the text of this element?
    <p class="red" id="intro">Hi</p>
    CSS:
    p { color: red; }
    .red { color: green; }
    (a) green (b) red (c) yellow (d) white
  9. 9.📱 Responsive design means a page ___. (a) never changes (b) is only for laptops (c) fits every screen (d) has no pictures
  10. 10.📦 How much space top to bottom (px) does this box take in all, margin included?
    .box {
      height: 50px;
      padding: 20px;
      border: 5px solid black;
      margin: 5px;
    }
  11. 11.✍️ In color: blue; which part is the property? (a) blue (b) color (c) ; (d) :
  12. 12.📱 The screen is 414px wide. What font-size (px) does the paragraph get?
    p {
      font-size: 16px;
    }
    @media (max-width: 1024px) {
      p {
        font-size: 12px;
      }
    }
  13. 13.⚖️ What colour is the text of this element?
    <p class="note" id="end">Hi</p>
    CSS:
    #end { color: yellow; }
    p { color: blue; }
    .note { color: red; }
    (a) red (b) white (c) yellow (d) blue
  14. 14.🎨 What does CSS stand for? (a) Colourful Site Styles (b) Creative Sheet System (c) Cascading Style Sheets (d) Computer Style Sheets
  15. 15.✍️ How does a CSS comment start? (a) /* (b) <!-- (c) # (d) //
  16. 16.True or false: padding is a solid or dotted edge. (a) False (b) True
  17. 17.⚖️ Two rules with the same selector set a colour. Which one wins? (a) the shorter one (b) the first one (c) the later one (d) neither
  18. 18.🎯 Can many elements share the same class? (a) No (b) Yes
  19. 19.🔍 Which is the odd one out? (a) shows a pop-up message (b) reacts to a button click (c) counts down a timer (d) sets colours and fonts
  20. 20.📦 How wide (px) is this box from the outer edge of its left border to the outer edge of its right border?
    .box {
      width: 300px;
      padding: 10px;
      border: 4px solid black;
      margin: 20px;
    }
  21. 21.🌈 Which colour of light is strongest in rgb(178, 24, 63)? (a) red (b) green (c) blue
  22. 22.📱 The screen is 820px wide. Does the rule inside @media apply?
    p {
      font-size: 24px;
    }
    @media (min-width: 600px) {
      p {
        font-size: 26px;
      }
    }
    (a) Yes (b) No
  23. 23.🎯 Which sign starts a class selector? (a) & (b) . (c) @ (d) #
  24. 24.True or false: body is a class selector. (a) False (b) True
  25. 25.🔍 Which is the odd one out? (a) gives the page structure (b) puts a picture on a page (c) changes the page live (d) makes a link
  26. 26.What does background-color do? (a) centres a heading (b) colours behind the text (c) picks the font style (d) sets the letter colour
  27. 27.⚖️ What colour is the text of this element?
    <h2 class="note" id="end">Hi</h2>
    CSS:
    h2 { color: green; }
    .note { color: blue; }
    #end { color: purple; }
    (a) blue (b) purple (c) green (d) black
  28. 28.📦 In the box model, which part is space outside the border? (a) border (b) content (c) padding (d) margin
  29. 29.💪 How wide (px) is each gap between two boxes?
    .row {
      display: flex;
      width: 300px;
      justify-content: space-between;
    }
    Inside are 3 boxes, each 80px wide (no margins).
  30. 30.🧩 Which language gives the page structure? (a) CSS (b) JavaScript (c) HTML
  31. 31.✍️ How many declarations (property: value pairs) are in this rule?
    p {
      border: 2px solid;
      text-align: center;
      color: red;
    }
  32. 32.✍️ Which sign goes between a property and its value? (a) ; (b) : (c) - (d) =
  33. 33.⚖️ What colour is the text of this element?
    <h1 class="red" id="logo">Hi</h1>
    CSS:
    #logo { color: purple; }
    .red { color: green; }
    (a) black (b) green (c) white (d) purple
  34. 34.🎯 Which element does the selector .box style? (a) <span class="menu"> (b) <div class="star"> (c) <div id="box"> (d) <div class="box">
  35. 35.🎨 Which tag connects an outside CSS file? (a) <css> (b) <img> (c) <link> (d) <a>
  36. 36.True or false: the content is the line round the box. (a) True (b) False
  37. 37.⚖️ What colour is the text of this element?
    <h2 class="menu" id="end">Hi</h2>
    CSS:
    #end { color: green; }
    #end { color: orange; }
    (a) orange (b) yellow (c) black (d) green
  38. 38.✍️ CSS declarations go inside which brackets? (a) { } (b) [ ] (c) ( ) (d) < >
  39. 39.True or false: .star is a class selector. (a) True (b) False
  40. 40.💪 How much empty space (px) is before the first box?
    .row {
      display: flex;
      width: 420px;
      justify-content: center;
    }
    Inside are 4 boxes, each 80px wide (no margins).

Answer key

  1. False
  2. blue
  3. h1
  4. orange
  5. Yes
  6. on the left
  7. True
  8. green
  9. fits every screen
  10. 110
  11. color
  12. 12
  13. yellow
  14. Cascading Style Sheets
  15. /*
  16. False
  17. the later one
  18. Yes
  19. sets colours and fonts
  20. 328
  21. red
  22. Yes
  23. .
  24. False
  25. changes the page live
  26. colours behind the text
  27. purple
  28. margin
  29. 30
  30. HTML
  31. 3
  32. :
  33. purple
  34. <div class="box">
  35. <link>
  36. False
  37. orange
  38. { }
  39. True
  40. 50

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