DEV Community

Discussion on: Tell me about the worst CSS you've ever had to deal with

kawhyte profile image
Kenny Whyte

"CSS: The !important Wars"

This would be great on a t-shirt.🤣

dansilcox profile image
Dan Silcox

The sequel will be “CSS: the z-index strikes back” 😂

Thread Thread
mateus_vahl profile image
Mateus Vahl

Yup! Since I had this issue, I now follow this global variable approach:

$z-index: (
  menu: 10,
  offcanvas: 20,
  lightbox: 30

@mixin z-index($key) {
  z-index: map-get($z-index, $key);

Everything on the page that could overlap is defined above.