HTML/CSS Service

Z-Index in CSS

Category: CSS, CSS3 Tutorial    |    787 views    |    1 Comment  |   

 

 

What is z-index

 

When you’re using CSS positioning to position elements on the page, you need to think in virtual 3-D. Each element on the page can be layered on top or beneath any other element. The z-index determines where in the stack each element is. I like to think of the elements as pieces of paper, and the Web page is a collage. Where I lay the paper is determined by positioning, and how much of it shows through the other elements is the z-index.

The higher a z-index value is, the more likely it will be on top when the page displays. A z-index can be negative. This tells the browser to put it lower than other elements on the page (with lower negative numbers being lower on the stack).

How to Use z-index

Use z-index with any element that you have position information on. You need to have the position attribute set, usually to position:absolute; But the specification says that z-index will work with relatively positioned elements as well. Read more…

Share/Save/Bookmark

 

CSS Property: z-index

Category: CSS, CSS 2 Tutorial, CSS Tips    |    365 views    |    Add a Comment  |   

Specifies the order of relative or absolutely positioned boxes in the z-axis. The higher the number, the higher that box will be in the stack.

Possible Values

  • inherit
  • auto (default)
  • [number]

Read more…

Share/Save/Bookmark