HTML and CSS Certification Practice Test 2026 - Free HTML and CSS Practice Questions and Study Guide

Question: 1 / 400

In CSS, what does the 'z-index' property do?

Controls the stacking order of overlapping elements

The 'z-index' property is a crucial aspect of CSS that affects the stacking order of overlapping elements in a web layout. When elements are positioned using CSS (for instance, with properties like 'position: relative', 'absolute', or 'fixed'), the 'z-index' can be used to specify which elements appear in front of or behind others.

A higher 'z-index' value means that the element will be rendered on top of elements with lower values. For example, if two overlapping elements have 'z-index' values of 10 and 5, respectively, the element with the 'z-index' of 10 will be positioned above the one with the 'z-index' of 5. If elements do not have a 'z-index' specified, they will follow the order in which they appear in the HTML document, with later elements stacking on top of earlier ones.

Understanding how 'z-index' works is important for layered designs, where you may want certain components, like modals or tooltips, to sit above the main content on the page. All of this makes it clear that the primary function of 'z-index' is to control the visibility order of overlapping elements.

Get further explanation with Examzify DeepDiveBeta

Specifies the zoom level of an element

Determines the size of the element

Defines the border thickness

Next Question

Report this question

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy