views:

161

answers:

3

I am a beginner to all things css and I've tried repeatedly to position an image(transparent png)over a centered table, but for some reason the graphic won't budge from the upper left corner of the browser. Absolute positioning should allow me to place the element anywhere I want. If someone could help determine what I've done wrong, I'd really appreciate it.

------------------------------------ html------------------------------------

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>

<title>Welcome to Knock on Wood Productions!<title>
<link rel="stylesheet" type="text/css" href="css/style.css" media="all" />

</head>

<body>
<div id="branch">

</div>

    <table width="803" border="0" cellpading="0" cellspacing="0" align="center">
    <tr>

        <!-- The 1st nested table starts here. -->

        <td width="355" height="180" background= "images/grn1.png">
 </td>
        <td width="10" height="180" background= "images/grn2.png"></td>
        <td width="438" height="180" background= "images/grn3.png"></td>
    </tr>    
    </table>

</body>

</head>

------------------------------------ css ------------------------------------

body                {   background-color: #fff8a7;

                       }

#wrapper         {  position: absolute; width: 803;
                        margin-left: auto ;
                         margin-right: auto ;


                      }

#branch          {  position: absolute; width: 548;
                    top: 60;
                        left: 50;
     /* background-image: url(images/gbranch.png); */
     z-index: 2;
                      }

td                { border: solid thin red;
+6  A: 

Give the parent element (in your case the centered table) a "position: relative".

Pekka
`position:relative` doesn't work on tables AFAIK.
DisgruntledGoat
+4  A: 

You specified lengths without units for the width, top and left properties. You should write:

#branch {
   width: 548px;
   top: 60px;
   left: 50px;
}

Also you might want to specify an height for that element, too.

FUMBLR
A: 

Fumblr's right - declare a height equal to the height of the image at least. Fumblr's code should work.

@Fumblr - I'd give you the thumbs up but I'm not allowed yet!

tahdhaze09