Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Cyborg)
  • No Skin
Collapse
Brand Logo

CIRCLE WITH A DOT

  1. Home
  2. Uncategorized
  3. The value of z-index from @csstricks

The value of z-index from @csstricks

Scheduled Pinned Locked Moved Uncategorized
5 Posts 2 Posters 0 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • amber@front-end.socialA This user is from outside of this forum
    amber@front-end.socialA This user is from outside of this forum
    amber@front-end.social
    wrote last edited by
    #1

    The value of z-index from @csstricks

    Link Preview Image
    The Value of z-index | CSS-Tricks

    How we look at the stacking order of our projects, how we choose z-index values, and more importantly, the implications of those choices.

    favicon

    CSS-Tricks (css-tricks.com)

    lukeharby@infosec.exchangeL 1 Reply Last reply
    0
    • amber@front-end.socialA amber@front-end.social

      The value of z-index from @csstricks

      Link Preview Image
      The Value of z-index | CSS-Tricks

      How we look at the stacking order of our projects, how we choose z-index values, and more importantly, the implications of those choices.

      favicon

      CSS-Tricks (css-tricks.com)

      lukeharby@infosec.exchangeL This user is from outside of this forum
      lukeharby@infosec.exchangeL This user is from outside of this forum
      lukeharby@infosec.exchange
      wrote last edited by
      #2

      @amber @csstricks

      z-index: 9999 drives me mad but I recently worked on a nice system in scss.

      amber@front-end.socialA 1 Reply Last reply
      0
      • lukeharby@infosec.exchangeL lukeharby@infosec.exchange

        @amber @csstricks

        z-index: 9999 drives me mad but I recently worked on a nice system in scss.

        amber@front-end.socialA This user is from outside of this forum
        amber@front-end.socialA This user is from outside of this forum
        amber@front-end.social
        wrote last edited by
        #3

        @lukeharby @csstricks the only time i do that is when working with slick slider in fade mode bc they set the slides to 9999. Its soooo annoying

        lukeharby@infosec.exchangeL 1 Reply Last reply
        0
        • amber@front-end.socialA amber@front-end.social

          @lukeharby @csstricks the only time i do that is when working with slick slider in fade mode bc they set the slides to 9999. Its soooo annoying

          lukeharby@infosec.exchangeL This user is from outside of this forum
          lukeharby@infosec.exchangeL This user is from outside of this forum
          lukeharby@infosec.exchange
          wrote last edited by
          #4

          @amber @csstricks

          So we tried to implement a semantic naming convention like (I think this is how bootstrap do it, as in the past I would have said $z-index__low, $z-index__high etc.)

          $z-index__1: 1
          $z-index__0: 0
          $z-index__minus1: -1 // a bit clunky

          And then you pass these to your actual elements and interpolate over them.

          So we've got a hamburger nav so that has to be the highest z-index

          .nav { z-index: $z-index__1 * 100 }

          No, no we need a modal so we need one higher:

          .modal { z-index: $z-index__1 * 101 }

          Shoot what if we need some toast inside the modal that z-index will need to be higher still. And so on. It can get away but much better than inheriting a codebase with hard coded integers that drives me up the wall.

          Hope I am not going off on one too much!

          At least with this you can still use any of the base variables elsewhere in your app.

          lukeharby@infosec.exchangeL 1 Reply Last reply
          1
          0
          • R relay@relay.infosec.exchange shared this topic
          • lukeharby@infosec.exchangeL lukeharby@infosec.exchange

            @amber @csstricks

            So we tried to implement a semantic naming convention like (I think this is how bootstrap do it, as in the past I would have said $z-index__low, $z-index__high etc.)

            $z-index__1: 1
            $z-index__0: 0
            $z-index__minus1: -1 // a bit clunky

            And then you pass these to your actual elements and interpolate over them.

            So we've got a hamburger nav so that has to be the highest z-index

            .nav { z-index: $z-index__1 * 100 }

            No, no we need a modal so we need one higher:

            .modal { z-index: $z-index__1 * 101 }

            Shoot what if we need some toast inside the modal that z-index will need to be higher still. And so on. It can get away but much better than inheriting a codebase with hard coded integers that drives me up the wall.

            Hope I am not going off on one too much!

            At least with this you can still use any of the base variables elsewhere in your app.

            lukeharby@infosec.exchangeL This user is from outside of this forum
            lukeharby@infosec.exchangeL This user is from outside of this forum
            lukeharby@infosec.exchange
            wrote last edited by
            #5

            @amber @csstricks

            Or I just realised we might have done:

            $modalIndex: $navIndex + 1;
            $toastIndex: $modalIndex +1;

            Also kind of clunky. Especially if you need one in between.

            1 Reply Last reply
            1
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups