Jump to content

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
https://forums.phpfreaks.com/topic/92802-have-2-divs-extend-together/
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.

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.