Skip to main content

Posts

Showing posts with the label CSS interview questions and answers

CSS interview questions with their theoretical answers

1. What is CSS? CSS (Cascading Style Sheets) is a stylesheet language used to describe the presentation (layout, colors, fonts, etc.) of a document written in HTML or XML. 2. What is the box model in CSS? The box model represents the structure of an HTML element, consisting of four areas: Content : The actual content of the element (text, images, etc.). Padding : The space between the content and the border. Border : The area surrounding the padding. Margin : The space outside the border, separating the element from other elements. 3. What is the difference between relative , absolute , fixed , and sticky positioning in CSS? Relative : Positions an element relative to its normal position. Absolute : Positions an element relative to its nearest positioned (non-static) ancestor. Fixed : Positions an element relative to the viewport, and it does not move when the page is scrolled. Sticky : A hybrid of relative and fixed positioning; the element toggles between relative and fixed based o...