CSS Interview Questions and Answers for freshers

100 CSS Interview Questions and Answers for Freshers
  1. What is CSS?

    • Answer: CSS stands for Cascading Style Sheets. It's a stylesheet language used to describe the presentation of a document written in HTML or XML. It controls aspects like colors, fonts, layout, and responsiveness of web pages.
  2. Explain the box model in CSS.

    • Answer: The box model is a fundamental concept in CSS. Every HTML element is treated as a rectangular box composed of: content (the actual text or image), padding (space between content and border), border (the line around the element), and margin (space between the element's border and other elements).
  3. What are selectors in CSS? Give examples.

    • Answer: Selectors target the HTML elements you want to style. Examples include: `element` (e.g., `p`), `class` (e.g., `.myclass`), `id` (e.g., `#myid`), `universal` (`*`), and combinators like `>` (child), `+` (adjacent sibling), `~` (general sibling).
  4. Explain the difference between inline, internal, and external stylesheets.

    • Answer: Inline styles are applied directly within HTML tags using the `style` attribute. Internal stylesheets are defined within the `