PDA

View Full Version : div inside a centered div


Kostaben
08-18-2007, 03:38 PM
I've put an APDiv in an centerd div but, the AP div is not moving with the main one. Can anyone tell me where is the problem.
Here is my code:

<style type="text/css">
<!--
body {
text-align : center ;
min-width : 770px ;
}

div.wrapper {
text-align : center;
margin-left : auto ;
margin-right : auto ;
}
#Layer1 {
position:absolute;
left:190px;
top:39px;
width:155px;
height:230px;
z-index:1;
}
</style>

<div class="wrapper">
<div id="Layer1">kj;lkfjg;slkfjgs;lkfdjg</div>
<img src="images/mainpage2.jpg" width="761" height="1018"></div>

designingdani
08-18-2007, 04:44 PM
seems to be the problem of the week. you, me and fedexer should start a css support group. :wink:

m1a2x3x7
08-18-2007, 05:20 PM
dont move it with left and top move it with margin-left margin-top

Kostaben
08-18-2007, 05:39 PM
Thats right Designingdani, or better a css course:mrgreen:

O.k., i put a : position:relative; to the wrapper div

div.wrapper {
position:relative;
text-align : center;
margin-left : auto ;
margin-right : auto ;
}

and it works with IE but, with Firefox not.

please any help.

Kostaben
08-18-2007, 05:41 PM
margin-left , margin-top does not solve the problem m1a2x3x7.

m1a2x3x7
08-18-2007, 06:28 PM
do this

#divWrapper{
height: 700px; (whatever you want it)
width: 760px; (whatever you want it)
margin: auto;
}

#Layer1 {
position:absolute;
margin-left:190px;
margin-top:39px;
width:155px;
height:230px;
z-index:1;
}

Kostaben
08-18-2007, 07:00 PM
Thank you for the reply m1a2x3x7.

The same result. Works with IE but not with Firefox

Kostaben
08-18-2007, 07:15 PM
Yeeees it works.
i didn't changed the div class to div id in the html code.
Thank you very much m1a2x3x7, it was a 2 weeks problem.

Here is the final code if someone need it.

<style type="text/css">
<!--
body {
text-align : center ;
min-width:700px;
}
#container{
height: 700px;
width: 760px;
margin: auto;
}

#Layer1 {
position:absolute;
margin-left:190px;
margin-top:39px;
width:155px;
height:230px;
z-index:1;
}
</style>

<div id="container">
<div id="Layer1">kj;lkfjg;slkfjgs;lkfdjg</div>
<img src="images/mainpage2.jpg" width="761" height="1018">
</div>

m1a2x3x7
08-18-2007, 07:32 PM
np glad i could help