How can I fix a div in a position and it can stay at the same place when I resize my windows?

Hello Guys

I have three DIVs:

First: It is a container that Allow me to center my second DIV in horizontal and vertical center.
In the middle of the second DIV I have another DIV and I want it to stay in the same place when I resize my window. How can I do that?

please, take a look at my code:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

<style type="text/css"> 
body {
        font-size: 12px;
        font-family: arial, helvetica, sans-serif;
        color: #333;
}
p {
        margin: 1em;
}
.comments {
        background-color: #e3e3e3;
        border-top: 1px solid #ccc;
        border-bottom: 1px solid #ccc;
        padding: 2px;
}
 
#mydiv {
        position:absolute;
        top: 50%;
        left: 50%;
        width:800px;
        height:600px;
        margin-top: -300px; /*set to a negative number 1/2 of your height*/
        margin-left: -400px; /*set to a negative number 1/2 of your width*/
        border: 1px solid #ccc;
        background: #FFF; 
}
 
table {position: relative; height: 500px; top: 50%; margin-top: -250px;}

#apDiv1 {
	position:fixed;
	left:200px;
	top:341px;
	width:235px;
	height:172px;
	z-index:1;
	background:#0066CC;
	overflow:auto;
}

</style>
</head>
<body>
<div id='mlk' class='menu' style='position:absolute; top:-10000px; left:-10000px;'></div>
<div id="mydiv" align="center">
   <table width="700" border="0">
    <tr>
      <td height="450"><img src="Imagem/entrada_ht_link_1.jpg" width="700" height="450" /></td>
    </tr>
 </table>    
</div>
<div id="apDiv1"></div>
</body>
</html>

Open in new window

LVL 1
hidrauAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Paul MacDonaldDirector, Information SystemsCommented:
Here's some info on element positioning: http://www.w3schools.com/Css/css_positioning.asp
It's not clear if you want the innermost DIV to be fixed relative to the browser window or it's parent DIV.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
hidrauAuthor Commented:
thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
CSS

From novice to tech pro — start learning today.