2

I don't know what is wrong with my code but I have set a z-index in my css like this:

.mat-mini-fab {
 position: absolute;
 right: 5px;
 top: 4px;
 z-index: 999;
 box-shadow: none !important;
}

But whenever I go to my site, the z-index is not applied and when I check in the developer console, there is always a # in front of the value so like this z-index: #999. I don't know where this comes from??

Tested in Chrome and Firefox. I am definitely sure in the code I never set the # before.

When I change this to 1000, there is no #, but below 1000 the # always is there... what kind of bug is this??

enter image description here

asked Jun 1, 2021 at 19:11
6
  • curiously - does this happen even with z-index: 999 !important; ? Commented Jun 1, 2021 at 19:19
  • 2
    Without more info it looks like your bundler/minifier/linter is detecting 999 as a hex value and trying to format it? How are you bundling your CSS? Where does the [_ngcontent-elm-c129] come from? Commented Jun 1, 2021 at 19:19
  • @chazsolo it comes from angular. Commented Jun 1, 2021 at 19:21
  • z-index: 999 !important; did not help. How can I check my bundler/minifier/linter? I am using a simple Angular project Commented Jun 1, 2021 at 19:57
  • Can you edit your question and post the versions of your Angular deps? Commented Jun 1, 2021 at 20:17

1 Answer 1

0

I got this problem after switching to Angular 12. Looks like a problem with the way Webpack bundles. I added the top limit of the z-index, then it did not add the #.

 z-index: 2147483647;
answered Jun 5, 2021 at 22:28
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.