z index property not applied


I am using the following html markup and css code to design my landing page.


<!DOCTYPE html>

<head runat="server">
    <link href="Styles/Site.css" rel="stylesheet" type="text/css" />
<body style="background:transparent;">
<div id="divContainer"></div>
    <form id="form1" runat="server">
    <div id="topDiv"></div>

    <div id="divMain">
    <aside><div id="logo">
    <img id="imgLogo" src="Images/minerva.jpg" />
        <div id="divContact"></div>


#topDiv {
    box-shadow: 0px 10px 20px #888888;
    background-color: #113871;
    width: 100%;
    height: 40px;
#logo { }
#imgLogo {
    width: 400px;
    height: 200px;
    margin-top: 20px;
    float: left;
#divContact {
    width: 300px;
    height: 400px;
    background-color: White;
    opacity: 0.5em;
    float: right;
    z-index: 9999;
    margin-right: 50px;
    margin-top: 149px;
    border-radius: 5px;
    -moz-border-radius: 5px;
    -webkit-border-radius: 5px;
    box-shadow: 0 0 .5em .25em Gray;
footer {
    width: 100%;
    height: 150px;
    background-color: #113871;
    display: block;
    float: left;
    margin-top: -100px;
    z-index: -1;

I have given z index value of 9999 for #divContact and -1 for the footer tag. My issue is I am not getting what want, that is to bring the divContact into front. Can anyone plase have a look.

Problem courtesy of: Joshua


z-index only works on positioned elements:

/* This does not work */
.foo {
    z-index: 10;

/* This works */
.bar {
    position: relative;
    z-index:  10;

Source: http://www.w3.org/TR/CSS2/visuren.html#z-index

Solution courtesy of: Sampson


The z-index will only work on an element whose position property has been explicitly set to absolute, fixed, or relative.

Discussion courtesy of: TheGeekYouNeed

How I know, z-index works only with elements with position css attribute. So I tried in browser inspector to set position:relative; to divContact and it now is in first plane.

Discussion courtesy of: Andrea V. Abbondanza

This recipe can be found in it's original form on Stack Over Flow.