CSS Interview Questions & Answers

Showing 10 of 103 questions | Page 2

Technical interview questions and answers are crucial when preparing for a CSS Interview because companies expect candidates to understand selectors, box model, layouts, responsive design, animations, and modern styling techniques. CSS is one of the most important skills for frontend development, and interviews often include both theoretical and practical questions. Companies such as TCS, Wipro, Infosys, Cognizant, and Accenture frequently ask CSS questions to evaluate a candidate’s ability to structure and style web pages professionally. This guide includes the most commonly asked CSS interview questions with easy explanations, helping freshers, students, and job seekers build a strong foundation. Preparing these questions will boost your confidence for frontend developer roles, UI/UX interviews, and campus placements.

Web designers should strengthen their frontend expertise by mastering HTML markup  and JavaScript interactivity  for responsive design 

Showing 10 of 103 questions

11. Why call the subtended angle a "pixel", instead of something else (e.g. "subangle")?

In most cases, a CSS pixel will be equal to a device pixel. But, as you point out, the definition of a CSS pixel will sometimes be different. For example, on a laser printer, one CSS pixel can be equal to 3x3 device pixels to avoid printing illegibly small text and images. I don't recall anyone ever proposing another name for it. Subangle? Personally, I think most people would prefer the pragmatic "px" to the non-intuitive "sa".

12. Why was the decision made to make padding apply outside of the width of a 'box', rather than inside, which would seem to make more sense?

It makes sense in some situations, but not in others. For example, when a child element is set to width: 100%, I don't think it should cover the padding of its parent. The box-sizing property in CSS3 addresses this issue. Ideally, the issue should have been addressed earlier, though.

13. Can CSS be used with other than HTML documents?

Yes. CSS can be used with any ny structured document format. e.g. XML, however, the method of linking CSS with other document types has not been decided yet.

14. Can Style Sheets and HTML stylistic elements be used in the same document?

Yes. Style Sheets will be ignored in browsers without CSS-support and HTML stylistic elements used.

15. How do I design for backward compatibility using Style Sheets?

Existing HTML style methods (such as and ) may be easily combined with style sheet specification methods. Browsers that do not understand style sheets will use the older HTML formatting methods, and style sheets specifications can control the appearance of these elements in browsers that support CSS1.

16. Why use Style Sheets?

Style sheets allow a much greater degree of layout and display control than has ever been possible thus far in HTML. The amount of format coding necessary to control display characteristics can be greatly reduced through the use of external style sheets which can be used by a group of documents. Also, multiple style sheets can be integrated from different sources to form a cohesive tapestry of styles for a document. Style sheets are also backward compatible - They can be mixed with HTML styling

17. What is CSS rule 'at-rule'?

There are two types of CSS rules: ruleset and at-rule. At-rule is a rule that applies to the whole style sheet and not to a specific selector only (like in ruleset). They all begin with the @ symbol followed by a keyword made up of letters a-z, A-Z, digits 0-9, dashes and escaped characters, e.g. @import or @font-face.

18. What is selector?

CSS selector is equivalent of HTML element(s). It is a string identifying to which element(s) the corresponding declaration(s) will apply and as such the link between the HTML document and the style sheet. For example in P {text-indent: 10pt} the selector is P and is called type selector as it matches all instances of this element type in the document. in P, UL {text-indent: 10pt} the selector is P and UL (see grouping); in .class {text-indent: 10pt} the selector is .class (see class selecto

19. What is CSS declaration?

CSS declaration is style attached to a specific selector. It consists of two parts; property which is equivalent of HTML attribute, e.g. text-indent: and value which is equivalent of HTML value, e.g. 10pt. NOTE: properties are always ended with a colon.

20. What is cascade?

Cascade is a method of defining the weight (importance) of individual styling rules thus allowing conflicting rules to be sorted out should such rules apply to the same selector. Declarations with increased weight take precedence over declaration with normal weight: P {color: white ! important} /* increased weight */ P (color: black} /* normal weight */
Questions and Answers for Competitive Exams Various Entrance Test