1.

Which of the following is positioned relative to the nearest positioned ancestor?(a) absolute(b) static(c) clip(d) relativeThis question was posed to me during a job interview.Asked question is from Sliding Doors & Clipped Sliding Doors topic in portion Layout & Images of CSS

Answer»

Correct choice is (a) absolute

Easiest explanation: An element with POSITION: absolute; is positioned relative to the nearest positioned ancestor, INSTEAD of position relative to the viewport LIKE fixed. However, if an absolute positioned element has no positioned ancestors, it uses the document BODY and moves along with PAGE scrolling.



Discussion

No Comment Found

Related InterviewSolutions