CSS stands for Cascading Style Sheets. It is a programming language used for describing the presentation and style of a document written in HTML or XML. CSS provides a set of rules and properties that define how elements should be displayed on a web page.
With CSS, web designers and developers can control various aspects of a website’s appearance, including layout, colors, fonts, spacing, and effects. By separating the style information from the content, CSS allows for a more efficient and flexible web development process.
CSS operates on a cascading principle, where multiple style rules can be applied to an element, and the final style is determined by the order of specificity and the application of different selectors. This allows for easy customization and consistency across web pages.
CSS selectors are used to target specific HTML elements or groups of elements to apply the desired styles. Selectors can be based on element types, class names, IDs, attributes, and more, providing great flexibility in styling.
You might like to know
Create an auto-grading quiz/assessment without any coding – try OnlineExamMaker today!
CSS3, the latest version of CSS, introduced numerous new features, including advanced layout options, transitions, animations, gradients, and more, enabling even more creative and interactive web design.
Article outline
- Part 1: 30 CSS quiz questions & answers
- Part 2: Download CSS questions & answers for free
- Part 3: Free online quiz creator – OnlineExamMaker
Part 1: 30 CSS quiz questions & answers
1. What does CSS stand for?
a) Cascading Script Style
b) Cascading Style Sheets
c) Computer Style Sheets
d) Creative Styling Solutions
Answer: b) Cascading Style Sheets
2. How is CSS typically used in web development?
a) To define the structure and content of a web page
b) To add interactivity and functionality to a web page
c) To describe the presentation and style of a web page
d) To manage server-side operations of a web page
Answer: c) To describe the presentation and style of a web page
3. Which HTML attribute is used to apply CSS styles directly to an HTML element?
a) style
b) css
c) class
d) id
Answer: a) style
4. Which CSS property is used to control the size and layout of boxes in CSS?
a) color
b) font-family
c) width
d) background-color
Answer: c) width
5. What is the correct CSS syntax to select an element with a specific class?
a) .class
b) #class
c) .class-name
d) class:
Answer: a) .class
6. Which CSS property is used to control the spacing between lines of text?
a) margin
b) padding
c) line-height
d) font-size
Answer: c) line-height
7. What is the correct CSS syntax to select an element with a specific ID?
a) .id
b) #id
c) #id-name
d) id:
Answer: b) #id
8. Which CSS property is used to change the color of text?
a) color
b) background-color
c) font-color
d) text-color
Answer: a) color
9. How can you include an external CSS file in an HTML document?
a) style tag
b) tag
c)
d)
Answer: b) tag
10. What is the CSS property used to add a background image to an element?
a) background-image
b) image-url
c) background-url
d) image-background
Answer: a) background-image
11. Which CSS property is used to control the size of text?
a) font-family
b) font-weight
c) font-size
d) text-size
Answer: c) font-size
12. How do you apply a CSS style to all `
` elements?
a) #h1 {}
b) .h1 {}
c) h1 {}
d)
{}
Answer: c) h1 {}
Answer: c) h1 {}
13. Which CSS property is used to control the spacing between letters?
a) margin
b) padding
c) line-spacing
d) letter-spacing
Answer: d) letter-spacing
14. What is the correct CSS syntax to select all elements inside a specific element?
a) parent-element all {}
b) parent-element > {}
c) parent-element ~ {}
d) parent-element * {}
Answer: d) parent-element * {}
15. Which CSS property is used to create rounded corners on an element?
a) border-radius
b) corner-radius
c) rounded-corners
d) border-style
Answer: a) border-radius
Part 2: Download CSS questions & answers for free
Download questions & answers for free
16. How do you apply multiple CSS classes to an element?
a) .class1, .class2 {}
b) #class1 .class2 {}
c) class1 class2 {}
d) class1 > class2 {}
Answer: a) .class1, .class2 {}
17. What is the CSS property used to add shadows to elements?
a) shadow
b) box-shadow
c) text-shadow
d) element-shadow
Answer: b) box-shadow
18. How do you select all elements of a specific type in CSS?
a) .element-type {}
b) #element-type {}
c) * {}
d) element-type {}
Answer: d) element-type {}
19. Which CSS property is used to control the vertical alignment of text within an element?
a) text-align
b) vertical-align
c) line-height
d) align-content
Answer: b) vertical-align
20. What is the CSS property used to control the display order of overlapping elements?
a) z-index
b) position
c) order
d) display
Answer: a) z-index
21. How do you apply a CSS style to a specific element based on its state, such as when it is hovered over or clicked?
a) :state
b) ::state
c) .state
d) :state{}
Answer: d) :state{}
22. Which CSS property is used to control the transparency of an element?
a) opacity
b) transparent
c) visibility
d) background-opacity
Answer: a) opacity
23. How do you apply a CSS style to the first child element of a parent element?
a) first-child {}
b) first-element {}
c) :first-child {}
d) :first-element {}
Answer: c) :first-child {}
24. What is the CSS property used to control the positioning of an element?
a) position
b) top
c) left
d) all of the above
Answer: d) all of the above
25. How do you select an element with a specific attribute value in CSS?
a) attribute[value]
b) attribute = value
c) attribute:value
d) attribute ~ value
Answer: a) attribute[value]
26. What is the CSS property used to create an underline effect on text?
a) text-decoration
b) underline
c) text-underline
d) line-decoration
Answer: a) text-decoration
Pro Tip
Want to assess your learners online? Create an online quiz for free!
27. How do you select the last element of a specific type in CSS?
a) .element-type:last {}
b) #element-type:last {}
c) :last-child {}
d) :last-element {}
Answer: c) :last-child {}
28. Which CSS property is used to control the positioning of background images within an element?
a) background-position
b) image-position
c) background-align
d) image-align
Answer: a) background-position
29. How do you apply a CSS style to an element when it is being clicked or activated?
a) :active
b) :hover
c) :click
d) :activate
Answer: a) :active
30. What is the CSS property used to control the spacing between words?
a) word-spacing
b) letter-spacing
c) line-spacing
d) text-spacing
Answer: a) word-spacing
Part 3: Free online quiz creator – OnlineExamMaker
With OnlineExamMaker software, you can easily enhance your assessment procedures, save time on grading, and gain valuable insights into learner performance. OnlineExamMaker grades quizzes automatically, and gives you access to detailed exam reports and statistics instantly. The insightful analytics help teachers and trainers gain valuable insights, enabling them to optimize their teaching methods.
Create Your Next Quiz/Exam with OnlineExamMaker