Top 25 CSS interview questions and Answers (2024): A Beginner-Friendly Guide

Welcome to Techminati

Be apart of our great community, join today!

daniyal

Administrator
Staff member
Jul 3, 2023
301
28
What is CSS?

  • CSS stands for Cascading Style Sheets. It’s used to control the appearance and layout of a web page, like changing colors, fonts, and spacing.
 
  • Thread starter
  • Admin
  • #2
What are the different ways to apply CSS to a webpage?

  • CSS can be applied inline (within an element’s style attribute), internally (in a <style> tag inside the HTML), or externally (through a separate .css file linked via the <link> tag).
 
  • Thread starter
  • Admin
  • #3
  • What is the difference between margin and padding?
    • margin creates space outside an element’s border, while padding creates space inside the border, between the content and the border.
 
  • Thread starter
  • Admin
  • #4
What is a CSS selector?

  • A CSS selector is used to target and style HTML elements. For example, p {color: red;} targets all <p> tags and sets the text color to red.
 
  • Thread starter
  • Admin
  • #5
What are pseudo-classes in CSS?

  • Pseudo-classes define the state of an element, like :hover when you hover over an element or :focus when an input field is focused.
 
  • Thread starter
  • Admin
  • #6
What is the box model in CSS?

  • The box model represents the structure of an element: content, padding, border, and margin. Each part affects the size of the element.
 
  • Thread starter
  • Admin
  • #7
What is the difference between relative, absolute, and fixed positioning?

  • relative positions an element relative to its normal position, absolute positions it relative to its nearest positioned ancestor, and fixed sticks it in place relative to the browser window.
 
  • Thread starter
  • Admin
  • #8
  • What is Flexbox?
    • Flexbox is a layout module in CSS that makes it easier to design flexible, responsive layouts. It’s great for centering items or creating equal-width columns.
 
Back
Top Bottom