Jump to content

have 2 divs extend together?


Northern Flame

Recommended Posts

How can i have 2 divs extend together?

lets say i have these 2 divs in the center of my

page:

 

<div id="left">
<h2>Left Side</h2>
<p>This is the left side of the layout.</p>
</div>
<div id="content">
<h2>Main Content</h2>
<p>This is where the main content goes....</p>
<h2>Another Paragraph</h2>
<p>This is another paragraph....</p>
<h2>Etc.</h2>
<p>.....</p>
</div>

 

 

all the content for both the left and center is different on each

page so i dont know how long it can be. i want them to both

have the same height. i've had them both extend together with

tables like this:

 

<table>
<tr>
	<td>
		<h2>Left Side</h2>
		<p>This is the left side of the layout.</p>
	</td>
	<td>
		<h2>Main Content</h2>
		<p>This is where the main content goes....</p>
		<h2>Another Paragraph</h2>
		<p>This is another paragraph....</p>
		<h2>Etc.</h2>
		<p>.....</p>
	</td>
</tr>
</table>

 

and that works fine, but i want to do this with divs. does anyone know

how i can do this with divs and css?

 

P.S. the divs each have borders so it will be obvious to the user if they do not

have the same height.

Link to comment
Share on other sites

This can be done with css. Tables are for tabular data and not for layouts.

 

1. Google "Faux Columns" - there is an article on A List Apart about it.

2. Google "Perfect 3 Column Liquid Layout" - can be used as a basis for fixed or liquid layouts with apparently equal height columns.

 

Link to comment
Share on other sites

Sure there is. Its a semantic mis-use of tables. Tables are supposed to hold tabular data, this data isn't tabular.

 

Not that it wont work. But I could wash myself with bleach everyday and become clean, that doesn't mean its the right way to use bleach.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.