peter_coop
asked on
center div between 2 divs
hello
i have 3 divs in a container. i seem to be having trouble getting the middle one (mailcenter) to center between the 2. i have attached my code and would be grateful if someone could tell me where i am going wrong. many thanks
i have 3 divs in a container. i seem to be having trouble getting the middle one (mailcenter) to center between the 2. i have attached my code and would be grateful if someone could tell me where i am going wrong. many thanks
css
==================================
#mailleft {
float: left;
width: 150px;
margin-top:180px;
margin-left:17px;
}
#mailright {
float: right;
width: 150px;
margin-top:180px;
}
.mailcenter {
float: left;
width: 70%;
margin-top:180px;
}
#container{
margin: 0 auto;
text-align: left;
width:97%;
}
html
===============================================
<div id="container">
<div id="mailleft">
<div id="accordion3">
<h2><a href="#">Mail</a></h2>
<div>First content</div>
</div></div>
<div class="mailcenter">
<div id="accordion">
<h2><a href="#"><?php echo $_SESSION['kt_name_usr']; ?></a></h2>
<div>First content</div>
</div></div>
<div id="mailright"><div id="accordion2">
<h2><a href="#">Utilities</a></h2>
<div>First content</div>
<h2><a href="#">Tools</a></h2>
<div>Second content</div>
</div></div>
</div>
ASKER
hi. if i remove the width totally throws the divs off. they seem to stack. also, other areas of the site rely on that container being that width. i have done a screenshot for your reference. thanks
divs.png
divs.png
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thank you
Try removing the width from the container and see what happens.
Also give the container a float left.