HTML and CSS Certification Practice Test

Image Description

Question: 1 / 400

What does the 'z-index' property control in CSS?

The size of an element

The visibility of an element

The stacking order of elements

The 'z-index' property in CSS is used to determine the stacking order of positioned elements. It allows developers to control which elements appear on top of others when they overlap. The value assigned to 'z-index' can be positive, negative, or zero, and the higher the value, the closer the element will be to the user, meaning it will be displayed above elements with lower 'z-index' values.

For instance, if two elements overlap and one is assigned a 'z-index' of 10 while the other has a 'z-index' of 5, the element with the higher 'z-index' will appear on top. It's important to note that 'z-index' only works on elements that are positioned (that is, those with a position value other than 'static').

In contrast to the other options, 'z-index' does not influence the size, visibility, or text color of elements. The size of an element is controlled through properties such as width and height, visibility through the visibility property or display property, and color through the color property. This specificity of 'z-index' makes it a powerful tool for managing the visual layering of elements on a webpage.

Get further explanation with Examzify DeepDiveBeta

The color of text

Next Question

Report this question

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy