帮助一个绝对定位的图像css卡在浏览器的左上角

0 html css absolute

我是所有事情的初学者,我曾多次尝试将图像(透明png)放在中心的桌子上,但由于某种原因,图形不会从浏览器的左上角移开.绝对定位应该允许我将元素放置在我想要的任何地方.如果有人可以帮助确定我做错了什么,我真的很感激.

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<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>
Run Code Online (Sandbox Code Playgroud)

------------------------------------ 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;
Run Code Online (Sandbox Code Playgroud)

Pek*_*ica 6

为父元素(在您的情况下为居中表)提供"position:relative".