Seenthis
•
 
Identifiants personnels
  • [mot de passe oublié ?]

 

b_b

@b_b
http://blog.eliaz.fr
RSS: b_b
tous les messages de b_b
  • @b_b
    b_b @b_b PUBLIC DOMAIN 22/03/2026

    The Value of #z-index | CSS-Tricks
    ▻https://css-tricks.com/the-value-of-z-index

    https://i0.wp.com/css-tricks.com/wp-content/uploads/2026/03/s_8926F490CDA74C2CA8D0B6E99405A055C6BF40F4CCE75686F0BAADE6ECBD39FB_1772115867944_image.png

    To maintain a clean and scalable codebase, here are the golden rules for working with z-index:

    – No magic numbers: Never use arbitrary values like 999 or 10001. If a number isn’t tied to a system, it’s a bug waiting to happen.
    – Tokens are mandatory: Every z-index in your CSS should come from a token, either a global layer token or a local positioning token.
    – It’s rarely the value: If an element isn’t appearing on top despite a “high” value, the problem is almost certainly its Stacking Context, not the number itself.
    – Think in layers: Stop asking “how high should this be?” and start asking “which layer does this belong to?”
    – Calc for connection: Use calc() to bind related elements together (like an overlay and its background) rather than giving them separate, unrelated tokens.
    – Local contexts for local problems: Use local tokens (—z-top, —z-bottom) and internal stacking contexts to manage complexity within components.

    #css

    b_b @b_b PUBLIC DOMAIN
    Écrire un commentaire

thèmes

  • #css
  • #z-index
Propriété intellectuelle Recommandations API