473,382 Members | 1,329 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Is it even possible? Simple 3 column 100% height fixed width

dlite922
1,584 Expert 1GB
I'm not sure why this is so complicated...

I simply want 3 equal width columns with equal height that grows to contain the longest column, all wrapped in a 1000px width container.

HTML:
Expand|Select|Wrap|Line Numbers
  1. <div id="wrap">
  2.   <div id="col1">
  3.  
  4.   </div>
  5.   <div id="col2">
  6.  
  7.   </div>
  8.   <div id="col3">
  9.  
  10.   </div>
  11.   <div id="clear"></div>
  12. </div>
  13.  
Here's a screen shot of what I'm looking for:



See how the first two column heights match the 3rd (longest) column?

Why do I want this? These columns will have a border and it looks tacky if one's short, etc.

CSS:
Expand|Select|Wrap|Line Numbers
  1. #wrap {
  2.     width: 1000px;
  3.     background-color: #333;
  4. }
  5.  
  6. #col1 {
  7.     float: left;
  8.     width: 300px;
  9.     border: 1px solid white;
  10.     background-color: red;
  11. }
  12.  
  13. #col2 {
  14.     width: 300px;
  15.     padding-left: 310px;
  16.     padding-right: 310px;
  17.     border: 1px solid white;
  18.     background-color: blue;
  19. }
  20.  
  21. #col3 {
  22.     float: right;
  23.     width: 300px;
  24.     border: 1px solid white;
  25.     background-color: green;
  26. }
  27.  
  28. .clear {
  29.     clear: both;
  30. }
  31.  
IE6+ compatible.

Any examples? where am I going wrong? Firefox render's this all over the place but don't know what's wrong.

Thanks for any help,


Dan
Aug 30 '10 #1
8 2853
JKing
1,206 Expert 1GB
A couple things here.

1) You have created a clear class in your css but you reference a clear id on your div.
Expand|Select|Wrap|Line Numbers
  1. <div class="clear"></div>
2) Col2 is extremely large once padding is taken into consideration. Your total width for that element including the border would be 922px leaving very little room for your other columns. For now I would remove the padding and leave that until the end. With all the columns in a 1000px width you have 94px left to pad them with.

3)Col2 needs float:left;

That should get all your columns lined up in the proper order.
Aug 30 '10 #2
JKing
1,206 Expert 1GB
To solve the problem of equal height there is a few methods to choose from however because you are using borders it can be more difficult.

I suggest going the javascript route to solve this problem. It works in all browsers and few users have it disabled. If they do have it disabled the site wont be broken just not as pretty.

There are CSS tricks too and you may prefer those,
Here is a good link: Equal Column Heights
Aug 30 '10 #3
tharden3
916 512MB
An easy fix using CSS would be to apply the "min-height" attribute in each of your columns:
Expand|Select|Wrap|Line Numbers
  1. min-height: 30em;
  2.  
Use this in each of your CSS column descriptions, or create a class and apply it to all three columns. Just make the size slightly larger than your largest column and they will all be the same size. This will not "grow" dynamically as you add content though. If your largest column grows taller than the min-height you specified, just go back and change the class.
Sep 2 '10 #4
drhowarddrfine
7,435 Expert 4TB
3 columns is easier than you'd think. The best way is to position each column 'absolute' and set the top/bottom to the top/bottom of its containing parent. I'd give more detail but I'm really, really busy.
Sep 2 '10 #5
kovik
1,044 Expert 1GB
JKing, that link's pure CSS solution is very interesting. I have to wonder who thought of that and then implemented it. o.o
Sep 4 '10 #6
dlite922
1,584 Expert 1GB
Thanks for all the replies. I ended up going with fixed height. I'll have to manually change it if content grows (BLEGH! UGLY!).

The javascript worked fine as well. simple one-line jquery, but I forget the reasons why I abandoned this.

We need HTML 5 and all these issues fixed.

All old browsers (such as <IE 7 and below) should automatically EXPLODE when HTML 5 comes out.

Thanks,


Dan
Sep 14 '10 #7
kovik
1,044 Expert 1GB
If we could get enough websites to completely remove support for older browsers and place large notifications on their websites for users of outdated browsers to update, we could do that.

In fact, only Facebook would need to have the notification. Problem solved.
Sep 15 '10 #8
Have you tried this one: http://www.cssplay.co.uk/layouts/threecol.html with an example here: http://www.cssplay.co.uk/layouts/3cols.html

There's also a lot of layout examples at: http://www.cssplay.co.uk/layouts/

Or simply this one: http://www.onderhond.com/blog/onderh...s-with-borders could get you an idea on how to do it.
Sep 15 '10 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

179
by: SoloCDM | last post by:
How do I keep my entire web page at a fixed width? ********************************************************************* Signed, SoloCDM
5
by: Andrew | last post by:
Could someone please tell me why this simple table test is completely mangled by Netscape? HTML: <TABLE WIDTH="90%" ALIGN="center" BORDER="0" CELLPADDING="0" CELLSPACING="1" BGCOLOR="Black">...
11
by: Not4u | last post by:
Hello, I have a problem with CSS code. I want to have one menu column with a fixed width and a 100% height and the rest of the page for content. ---------------- |.|.|<--100%-->|...
5
by: John Smith | last post by:
Here is my HTML table formatting code. <table border="1" width="100%"> <tr width = "100%"> <td width="33%">11asdhagdshaskgashjgahjgadhjgdjshdgasjdgajdgadjhgdgahjdgadhjsgad
1
by: joshthomas99 | last post by:
Hello, Yes, I've spent hours reading through all the old postings and searched the net - but couldnt find a solution to the 100% height problem with nested divs. Basically I want the first...
3
by: wokm4n | last post by:
Hi, I'm currently working on this: http://www.richardvenneman.nl/kazenokoe The left part of the 'latest releases' is fixed width. A random image appears on the right side. But there seems to...
31
by: Sarita | last post by:
Hello, this might sound stupid, but I got a really nice homepage template which unfortunately is a 3-Column Fixed Width CSS format. Now I don't have any content for the right column and would...
4
by: Alexander Eisenhuth | last post by:
Hello alltogether, is it possible to format stings with fixed width of let's say 7 character. T need a floating point with 3 chars before dot, padded with ' ' and 3 chars after dot, padded with...
4
by: Jeff | last post by:
Hey I'm wondering how the Fixed-Width Text Format is What I know is that the top line in this text format will contain column names. and each row beneath the top line represent for example a...
4
by: Christopera | last post by:
Hello, I have built a site that uses two divs, one verticle, and one horizontal as graphic style for the ite. The problem I am having is that if the browser is resized very small the divs are...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.