Artifacts Gallery Guilds Search Wiki Login Register

Welcome, Guest. Please login or register. - Thinking of joining?
Winter, 02 Dec 2026 - @85.51
Forum Activity: Four Stars Random | Recent Posts | Guild Recents
News: There's a great big indie web tomorrow! :smile: Guild Events: 23: cozy
Super News: ++ MelonJam 2026 ~ 1st Dec to 1st Jan! ++
+  MelonLand Forum
|-+  Da Web Revival
| |-+  ✁ ∙ Web Crafting
| | |-+  TIL z-index stacking contexts are relative...


« previous next »
Pages: [1] Print Embed
Author Topic: TIL z-index stacking contexts are relative...  (Read 1078 times)
dogbrain
Full Member ⚓︎
***
View Profile WWWArt


melting down army guys to make green tea
⛺︎ My Room
StatusCafe: robdog
iMood: robdog
RSS: RSS
OS: macOS + windows 11

Guild Memberships:
Artifacts:
Joined 2026!
« on: Spring, 13 May 2026 @900 » Toggle Font Embed

...as opposed to global, like i thought they were this entire time until now!!!  :skull:

i was fuming over not being able to position one rotated div in front of another (despite setting the z-index of the former to a stupidly high number) so i did some light googling and discovered that, apparently, z-indexes aren't global for the whole document; rather, new stacking contexts are created if you have any number of seemingly unrelated attributes on an element, and those exist in their very own 'bubbles'. in my case, it was because the div in question was rotated with transform  :drat:

i found this medium article that was helpful in explaining how this happens, but not why it happens. if anyone knows, i'm curious what about the transform property places elements in their own stacking contexts? is there a practical reason for it?? it seems weird to me that by simply applying a cosmetic change like rotation, it triggers its own stacking context o_o but i'm probably missing something!

Logged

it/he
https://files.catbox.moe/0fmlx1.gif https://file.garden/aJ42hERaRB8KTsjG/IMG_0702.gif
time is flying like an arrow, and the clock hands go so fast they make the wind blow, and it makes the pages of the calendar go flying out the window one by one
https://file.garden/aJ42hERaRB8KTsjG/IMG_1434.gif


Artifact Swap: Dig Creature
Dan Q
Hero Member ⚓︎
*****
View Profile WWWArt


I have no idea what I am doing
⛺︎ My Room
RSS: RSS

Guild Memberships:
Artifacts:
The Worm is creeping around Melonland profiles!Caught by RubbereonThe Worm is creeping around Melonland profiles!Dan Q Cruisin'I DIDN'T meet Dan Q on Melonland!Visited on Melon's 10th Anniversary!
« Reply #1 on: Spring, 14 May 2026 @316 » Toggle Font Embed

The simple answer is, I think... it just is.

The slightly-less-simple answer is probably... that some transformations are effectively equivalent to relative re-positioning. Which necessitates a new stacking context. So declaring in the spec that it does so could potentially allows some browser engines to short-cut their positioning engines.

That'd be my guess.

Logged

https://danq.me/_q26t/badges/dan-q-88x31-lighter.gif https://danq.me/_q26t/badges/dan-q-88x31-peekaboo-scroller.gif https://beige-buttons.danq.dev/beige-buttons-88x31.gif https://embed-html.danq.dev/embed-html-88x31.gif https://origami.danq.dev/88x31.gif https://skelly.monster/dem-bones-88x31.gif

Artifact Swap: Pink ham-ham rangerPolyamorousI met Dan Q on Melonland!shoeJoined 2025!cinnamoroll3 coins
Pages: [1] Print Embed 
« previous next »
 

Melonking.Net © Always and ever was! SMF © 2021 | Privacy Notice | Send Feedback | Supporters ♥ Guide | Rules | Whos a Mod? | RSS | WAP | Mobile


MelonLand Badges and Other Melon Sites!

MelonLand Project! Visit the MelonLand Forum! Support the Forum
Visit Melonking.Net! Visit the Gif Gallery! Pixel Sea TamaNOTchi
@000 Melon
Land
Forum Art Hub Chat Webring Explore Random Recent Tenement Arcade Want to Login or Join ? Web Craft Guide Graphic Catalogue Wiki Help I'm Lost! Link Land Newsletters Image Stream Minecraft: Online
Zap!
Passport Sites tamaNOTchi Asatte Add your site?
Aero Archive Onio Cafe 32 Bit Cafe Status Cafe