This article was written in 2015. It might or it might not be outdated. And it could be that the layout breaks. If that’s the case please let me know.
CSS stacking contexts
A good explanation by Tiffany B. Brown about how CSS stacking contexts work, and what triggers them. She also links to this article about the same topic by Philip Walton. Powerful stuff. Your (debugging) life is so much easier when you understand this.