Saturday, June 25, 2022
  • Home
  • Event
  • Technology
  • Program
  • Education
No Result
View All Result
E-Capitals
No Result
View All Result
Home Program

Topological sort – CSS-Tricks

admin by admin
December 17, 2021
in Program
0
0
SHARES
0
VIEWS
Share on FacebookShare on Twitter

Jordan Scales explores the computer science concept of topological sorting, and what it might look like if applied to the concept of z-index in CSS. So, you don’t express what the z-index should be directly; instead, you say exactly what other element you want to be on top of.

Related Posts

Single Element Loaders: The Bars | CSS-Tricks

Different Ways to Write CSS in React | CSS-Tricks

How to Become a Software Developer Fast?

CCNA vs CCNP – Detailed Guide and Differences

I think it’s more of a proof-of-concept, but it’s fun to look at anyway:

const resolver = new ZIndexResolver();

// A nav with dropdowns
resolver.above(".nav", "main");
resolver.above(".dropdown", ".nav");
resolver.above(".submenu", ".dropdown");

// Tooltips in the document
resolver.above(".tooltip", "main");

// Modals should go above everything
resolver.above(".modal", ".nav");
resolver.above(".modal", ".submenu");
resolver.above(".modal", ".tooltip");

console.log(resolver.resolve());

That produces an array in the right order:

[ '.modal', '.tooltip', '.submenu', '.dropdown', '.nav', 'main' ]

…which you can skoosh into CSS:

main { z-index: 0; }
.nav { z-index: 1; }
.dropdown { z-index: 2; }
.submenu { z-index: 3; }
.tooltip { z-index: 4; }
.modal { z-index: 5; }

The problem I see here is that it doesn’t account for stacking contexts. And if there is a bug with z-index, it’s always the stacking context. There is no possible z-index value that will raise up an item in a lower stacking order above any other items that are in a higher stacking context. So, to make something like this work effectively, I think it would have to know what (possibly nested) stacking context each item is in, then either attempt to jostle the stacking context themselves, or warn you that what you are asking for won’t work.


Direct Link →

Next Post

20 Activities to Support Letter Naming Fluency

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Popular Posts

Technology

Amazon, robots, and diverging views of automation and the future of work – GeekWire

by admin
June 25, 2022
0

Tye Brady, Amazon Robotics chief technologist, with Digit, a bipedal warehouse robot developed by Agility Robotics, a company in which...

Read more

Amazon, robots, and diverging views of automation and the future of work – GeekWire

Univ. of Washington spinout aims to eliminate ‘forever chemicals’ with destruction tech system – GeekWire

Microsoft hires cloud security VP; Expedia board member resigns; and more – GeekWire

Teachers Share the Unwritten Rules of Teaching

Single Element Loaders: The Bars | CSS-Tricks

New Web3 video game from ‘Days Gone’ director set in post-apocalyptic Pacific Northwest – GeekWire

Load More

Popular Posts

Best Winter Olympics Activities for Kids in the Classroom

by admin
January 19, 2022
0

What is Packet Sniffing Attack? – Types and How to Prevent It?

by admin
December 11, 2021
0

Zain Nadella, 1996-2022: Microsoft CEO’s son remembered for love of music, bright smile, profound impact on his dad

by admin
March 1, 2022
0

Copyright © 2021 - e-Capitals.com DESIGNED AND DEVELOPED BY TEAM WORDPRESS BLOGX

No Result
View All Result
  • Home
    • Home 1
    • Home 2
    • Home 3
  • Event
  • Technology
  • Program
  • Education

Copyright © 2021 - e-capitals.com - DESIGNED AND DEVELOPED BY TEAM WORDPRESS BLOGX