Advanced CSS interview questions part 2

This is the part 2 of advanced CSS interview questions. Front-end web developer needs CSS knowledge every now and then. It is really important to take some CSS preparation for any front-end developer interview. Following are some CSS interview questions for developers:

  • What are the differences between position relative vs position absolute?
  • Which selector (ID, class or tagName) has highest priority in CSS and why?
  • The CSS units of length are: cm, em, in, mm, pc, pt, and px. Please explain each of them.
  • What are the differences between display:inline-flex and display:flex?
  • What is the difference between div * and div > * in case of CSS selectors?
  • How to maintain the aspect ratio of a div using CSS?
  • What are the differences between vh/vw and %?
  • What a “reset” CSS file and why we need it?
  • Show techniques of vertically and horizontally centred image inside a div
  • How the concept of inheritance is used in CSS?