CSS Interview Questions and Answers for 2 years experience
-
What is CSS?
- Answer: CSS stands for Cascading Style Sheets. It's a language used to style HTML and XML documents. It describes how HTML elements should be displayed on screen, paper, or in other media. It controls aspects like colors, fonts, layout, and responsiveness.
-
Explain the box model in CSS.
- Answer: The box model is a fundamental concept in CSS. Every HTML element is rendered as a rectangular box. This box consists of: content (the actual text or image), padding (space between content and border), border (the border surrounding the content and padding), and margin (space between the border and other elements).
-
What are the different ways to include CSS in an HTML document?
- Answer: There are three main ways: 1) **Inline styles:** using the `style` attribute within an HTML tag. 2) **Internal stylesheet:** placing `