Style Sheets
  Home arrow Style Sheets arrow Page 3 - Introduction to CSS Positioning Properties...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Moblin 
JMSL Numerical Library 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
STYLE SHEETS

Introduction to CSS Positioning Properties Part 2
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 9
    2005-02-28

    Table of Contents:
  • Introduction to CSS Positioning Properties Part 2
  • The "clear" property
  • The "z-index" property
  • The "visibility" property
  • The "overflow" property
  • A simple drop-down menu using the "overflow" and "display" properties

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Introduction to CSS Positioning Properties Part 2 - The "z-index" property


    (Page 3 of 6 )

    The "z-index" property is used to specify how elements stack on top of each other in a document. The default value for each element is z-index: 0 or "auto," and values between 0 and 32767 can be specified. This property is very useful when we're dealing with two or more elements partially or completely overlapped each other. In this case, the element with the highest "z-index" will be displayed on top. If two or more elements have the same value for this property, the stacking order will be determined by the element source code order.

    A simple example would be:

    <style type="text/css">

    #element1 {

         position: absolute;

         width: 500px;

         top: 200px;

         left: 100px;

         z-index: 1;

    }

    #element2 {

         position: absolute;

         width: 500px;

         top: 200px;

         left: 150px;

         z-index: 2;

    }

    </style>

    In the above example, we've defined two elements which are absolutely positioned in the document. They're overlapping each other, but the second element will be displayed on top of the first one, since its z-index property is set to 1. This means it will be stacked as the top element.

    One common use for this property is related to CSS drop-down menus, which need to be overlapped over other page elements to achieve the desired visual effect. Usually, menu containers elements will be positioned on top of the stack, and displayed or hidden accordingly to their "visibility" property. By the way, that's the next visual property to be presented in this guide.

    More Style Sheets Articles
    More By Alejandro Gervasio


       · In this second part, I describe some useful properties such as float, overflowand...
       · The comments posted previously are comming from me, the author.Thank...
       · Is very misleading while being utterly useless. A menu is a structured list of...
       · Dear Sir,Thank you for stopping at the article and take some time to read...
       · I can't see why you say that "The elements are clickable inside the containing...
       · I'm new to CSS and found your article very helpful. I really like that I could...
       · Hello friend,After analyzing the topic, I ended up with the same conclusion. The...
       · Hello Paul,Thank you for the comments about the article. Regarding the example,...
       · I found Eric's demos of css menus to be a real help as well as this article.You...
       · ( Page 3 of 6 )I'm pretty sure there's a major typo on this page - surely the...
       · Hello friend,Thank you for pointing an excellent resource about the topic. It's...
       · Hi,Yes, You're correct. where it's specified z-index: 1; should read z-index:...
     

    STYLE SHEETS ARTICLES

    - Creating Hybrid Web Page Layouts with Negati...
    - Creating Three-Column Web Page Layous with N...
    - Swapping Column Positions in Web Page Layout...
    - Creating Web Page Layouts with Negative Marg...
    - Creating Gradients for Individual Containers...
    - Creating Gradients for Web Page Headers with...
    - SEO Scrolling Frames Problem Solved
    - Building Cross-Browser Background Effects wi...
    - CSS: Pseudo
    - Using PNG Images to Build Background Effects
    - CSS: Continuing the Clarification of CSS Cla...
    - CSS: Top Secret Classification
    - CSS: Dimensions
    - CSS: Margins and Padding
    - CSS: Crossing the Border






    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
    Stay green...Green IT