css padding height relationship

i have two div tag.
div1 and div2
do you know how div1 can follow div2 height?

http://www.filemakersupport.net/kad/design02/index.html
Picture-3.png
Hiroyuki TamuraField EngineerAsked:
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.

matthewrhoadesCommented:
So you want them side by side as above the same height?  Next to each other?
0
matthewrhoadesCommented:
HTML:

<div id="container">
     <div id="div1"></div>
     <div id="div2"></div>
</div>

CSS:

#container { background: url(the_Url_Of_The_Background_Image.gif) repeat-y 0% 0%; }
#div1 { float:left; width:50%;}
#div2 { marging-left:50%; width:50%;}
0
quincydudeCommented:
You can also use the table approach

<table id="holder">
     <tr><td>
             <div id="div1"></div>
     </td><td>
             <div id="div2"></div>
     </td></tr>
</table>

with style
#holder {vertical-align:top; border: 0px;}
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Hiroyuki TamuraField EngineerAuthor Commented:
thank you.
i have two div, #lowerright and #lowerleft
i set container div.
even i don't have any background image, do i have to set some?
0
quincydudeCommented:
you do not have to add the style

#container { background: url(the_Url_Of_The_Background_Image.gif) repeat-y 0% 0%; }

if you do not have a background set
0
Hiroyuki TamuraField EngineerAuthor Commented:
thank you.
i'm trying to test it.
could you please take a look this test site;
http://www.filemakersupport.net/kad/design04/index.html
do you know what's wrong with it?
0
David S.Commented:
You mistyped "margin".

The CSS Validator is great for finding errors like that: http://jigsaw.w3.org/css-validator/
0
quincydudeCommented:
#div2 { marging-left:50%; width:50%;} should be
#div2 { margin-left:50%; width:50%;}

you can also try out the code I posted as putting it in a cell ensures the items in different cells to be on the same row, in other words, placed horizontally.
0
Hiroyuki TamuraField EngineerAuthor Commented:
thank you.
now div2 left-border doesn't align.
http://www.filemakersupport.net/kad/design02/resources.html
do you know why?
0
quincydudeCommented:
seeing your page make me think you should implement it using table instead. As Divs are independent of each other's positioning but table cells can control it well.
Here's the sample layout of your site in table format.
<table id="main">
 
	<tr><td id="upperleft"></td>
 
	<td id="upperright">
		<div id="image_title">
			
		</div>
	</td>
	</tr>
 
	<tr><td id="lowerleft">
	</td>
 
	<td id="lowerright">
 
		<div id="image_main">
        </div>
	</td>
	</tr>
	<tr><td id="bottom" colspan="2">
	
	</tr>
</table>

Open in new window

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
matthewrhoadesCommented:
Tables are not intended to be used for display purposes as DIVs and SPANs are.

http://www.yourhtmlsource.com/stylesheets/csslayout.html

If you have problems with your DIV positioning you can set relative, static and absolute positioning to ensure that everything lines up where you want it to.  

Set the TOP attribute of your DIV elements to the same value and you will be fine lining them up horizontally.  If you want to line them up vertically set the LEFT attribute the same across the board.

DIVs seem a little bit more painful when tables are so easy to format, but it is the correct way of doing it.
0
colinspursCommented:
Hi,

Try this:

Float: left; the 2 right hand divs; clear: both for the bottom div.  Give lowerright the same width as upperright ie 600px.  I think that's it...here's the new CSS.

I changed some border colours for clarity in testing, and added my own image for the same reason.

My test result is in http://fobgfc.org/aaa.php

Cheers,
   
    Colin
#upperleft {
width : 81px;
height : 130px;
float : left;
border-bottom : 2px solid red;
}
#upperright {
float: left;
width : 600px;
height : 130px;
margin-left : 0;
border-left : 2px solid green;
border-bottom : 2px solid green;
}
#lowerleft {
width : 81px;
float : left;   
height : 250px;
border-right: 2px dotted orange;
}
#lowerright {
height : 500px;
border-left : 2px solid blue;
float: left;
width: 600px;          
}
 
#bottom {
width : 100%;
height : 35px;
text-align : center;
clear: both;        
}

Open in new window

0
colinspursCommented:

Whoops that should be http://www.fobgfc.org/aaa.php
0
Hiroyuki TamuraField EngineerAuthor Commented:
thank you all,
i get small space in between.
http://www.filemakersupport.net/kad/design04/design01.html
do you know how to fix this?
0
colinspursCommented:
You have not implemented my suggestions, notably floating the right hand side divs.

Also, using IE7 the problems are more evident than just small spaces present.
0
Hiroyuki TamuraField EngineerAuthor Commented:
Thank you.
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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.