get in touch

Z-Indexes Made Easy with the new 3D Firefox Inspector ‘Tilt’

When building a website brimming with lots of different elements in close proximity, particularly ones that float or slide above one another, an important consideration is always the z-index.

 

so what the hell is a z-index when it’s at home?

 
The z-index is a CSS property that refers to how elements are stacked on top of one another, simply it is where they are in the pile. Technically speaking it’s derived from what would be the z-axis on a graph standard graph. The z-axis is what takes you from a 2D ‘x’ and ‘y’ axes, to the third dimension. Okay, that sounded way more exciting and complex than it is…

So the higher the z-index is the closer the layer is to your eyeballs (or the top of the stack of elements sitting on top of one another, however you’d like to think about it). You can even set negative z-indexes if you’d like to push something further back.

(N.B: In order to set your z-index you must set the element’s position to either ‘relative’, ‘absolute’ or ‘fixed’.)

For example:

1
2
3
4
5
6
7
8
9
10
#bottomlayer {
position: relative;
z-index: 3;
}
</code>

<code>#toplayer {
position: relative;
z-index: 10;
}

Provided the two elements are in the same place with regards to their x,y co-ordinates (they may need to be floated above one another), the element with the ID ‘toplayer’ will sit on top of ‘bottomlayer’.

(Apparently the maximum z-index in most browser is 2147483647! I would stick to smaller numbers as they is nothing more annoying than maxing out your z-index and having to go back and change them all. A good tip is to use them in hundreds then you’ve got plenty of numbers in between in case you need them!)

 

so what’s wrong with coding z-indexes?

 
The trouble is while everything seems fairly straightforward in theory, when you have a truck load of elements all lying on top of one another on a page, you can sometimes get lost as to what is covering what. The old Firefox or Google Chrome inspectors aren’t particularly helpful because if one element is being covered by another, you’re inevitably only be able to inspect the top element because it’s in the way (Adobe Photoshop users that have been irritated by the ‘Auto-Select’ function may be able to relate to this!).

So the clever people down at Mozilla have created a slick solution to this pesky problem. Also known as ‘Tilt’ this amazing feature allows users to see a fully rotatable, 3D render of the page; which is interactive insofar as elements can be selected with a single click! You can now flip your page on its side and visualise exactly how the elements are stacked on top of one another, which definitely beats looking at a bunch of numbers :) . Moreover, the interface is lightning quick and feels totally seamless; plus it looks ridiculously sick.

 

how to access Firefox 3D View

 
It’s nice and easy…. Make sure you have the latest version of Firefox installed, right click an element you’d like to inspect on a web page and hit ‘Inspect’.

(Or alternatively, go to the Firefox drop down in the top left > Web Developer > Inspect… or hit ‘Ctrl+Shift+i’)…

Then click the button labelled ‘3D View’ on the bottom right and away you go!…

 

final thoughts…

 
Good job Mozilla. It’s made our lives a little bit easier.

If you’re having trouble with your z-indexes and would like a brand spanking new fresh site, we may be able to help you…

Check out our work and get in touch with us today!


who are we?

Hex Digital is a full-service digital agency based in London Bridge. We build beautiful, scalable, functional websites and mobile applications. We also provide strategic marketing consultancy and fulfilment.

Categories

feel free to leave a comment...

latest news

thumb-hex

Over the past few months I have been trying to work on improving my time management. As an SEO, where time is spent creating value for the client, time management is an important skill to learn.

Well thought out timelines for each client can certainly help with project management, but … Read More »

...
read more
blogthumb-ides

Below is a simple and awesome way to look back on the progress of the race for the current US Presidential Election, using Google Trends, mixed with news headlines.
The graphs show – quite simply – a normalized representation of worldwide data for the search queries “barack obama” and “mitt romney” … Read More »

...
read more
thumb

The Invisible Web (Deep Web) refers to the expanse of information on the World Wide Web which is not indexed by Search Engines. Many people think search engines such as Google and Bing are the internet’s wisest oracles; the reality is that their web spiders follow hyperlinks and index pages… … Read More »

...
read more

get in touch today...

or give us a call, we're nice :)
0800 689 9250