31.0k views
4 votes
Which CSS property specifies the stacking order of elements when they overlap, with a higher value indicating a greater likelihood of being placed in front of another?

a) position
b) z-index
c) display
d) float

User Baj Mile
by
7.1k points

1 Answer

1 vote

Final answer:

The CSS property that specifies the stacking order of elements is 'z-index'. It requires the elements to have a position value other than 'static'. The higher the z-index, the greater the likelihood the element will display on top.

Step-by-step explanation:

The CSS property that specifies the stacking order of elements when they overlap is z-index. The z-index property works in conjunction with the position property. Only elements with a position value other than static (i.e., relative, absolute, fixed, or sticky) can be affected by z-index. The higher the z-index value, the more likely the element is to be displayed in front of another overlapping element. If multiple elements have been given a z-index, the one with the highest value will appear on top. It's important to use z-index sparingly and with consideration of the entire document flow to avoid complex stacking issues.

User Luvaas
by
7.4k points