Instagram | Twitter | LinkedIn
Consider the following code:
| CSS | HTML |
|---|---|
![]() |
![]() |
What would you see in the browser ?
Click here to see the correct answer and explanation 馃憖
| Correct Answer | Explanation |
|---|---|
| A 馃帀 | yellow is rendered under red because red's z-index (5) is valid within the stacking context of the root element, while yellow's z-index (6) is valid within the stacking context of blue. So, yellow is under red, because yellow belongs to blue, which has a lower z-index value. See the code here. |
Recommended reading 馃憠馃徏 The stacking context
Considera el siguiente c贸digo:
| CSS | HTML |
|---|---|
![]() |
![]() |
驴 Qu茅 ver铆as en el navegador ?
Haz click aqu铆 para ver la respuesta correcta y su explicaci贸n 馃憖
| Respuesta correcta | Explicaci贸n |
|---|---|
| A 馃帀 | yellow es renderizado debajo de red porque el z-index (5) de red es v谩lido dentro del contexto de apilamiento del elemento ra铆z, mientras que el z-index (6) de yellow es v谩lido dentro del contexto de apilamiento de blue. As铆 que yellow est谩 debajo de red, porque yellow pertenece a blue, que tiene un valor z-index menor. Mira el c贸digo aqu铆. |
Lectura recomendada 馃憠馃徏 El contexto de apilamiento



Option A