0

So I am in the process of making a webpage. I need to use Z-Index so I can have some cool effects and such. I have come to the point where I need to make a fixed navigation bar and use Z-Index: 2(for example)Is there any equivalent to Z-index while using position: fixed?

Thanks in advance.

Noah Huppert
  • 4,028
  • 6
  • 36
  • 58
  • 1
    Possible duplicate: [http://stackoverflow.com/questions/5218927/z-index-not-working-with-fixed-positioning](http://stackoverflow.com/questions/5218927/z-index-not-working-with-fixed-positioning) – OzrenTkalcecKrznaric Jul 05 '13 at 16:55
  • What problem are you having? Z-index should work on elements with `position: fixed`. – Justin Chmura Jul 05 '13 at 16:56
  • It looks like setting position to relative on the other elements may help. – isherwood Jul 05 '13 at 16:56
  • This is not the case. In that question it looks like the person div positions and styles were creating the problem. I'm wondering if there are any equivalents. – Noah Huppert Jul 05 '13 at 16:56

2 Answers2

1

Z-index applies to any object with a position value, whether it is fixed, absolute or relative. If you've applied a position value (in this case fixed) to your object, then z-indexing should behave as it does with any other positioned object.

If you are having a specific problem, you'd need to elaborate more in your question.

relic
  • 1,662
  • 1
  • 16
  • 24
  • Hmm, Ill have to look at my code more. – Noah Huppert Jul 05 '13 at 16:59
  • Turns out that one of my scripts was screwing with the Z-index of another element and I had put in the wrong layer causing it to appear to not work. My fault :). – Noah Huppert Jul 05 '13 at 17:04
  • Something you may be having trouble with, objects with no position applied will sometimes overlap z-index'ed objects. If you have objects you want to go behind your fixed object, give them position:relative (don't necessarily need a z-index too) and that should allow them to fall into place behind higher indexed objects. – relic Jul 05 '13 at 17:04
0

http://www.fiveminuteargument.com/fixed-position-z-index

According to the above mentioned article we can use z-index with fixed positioning!

Mohammad Areeb Siddiqui
  • 9,795
  • 14
  • 71
  • 113