| | |
Floating problems
Please support our HTML and CSS advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
hi guys,
I am designing a website. The site has to have 3 columns, so i floated the left bar to the left. Didn't float the main, middle content and i floated the right bar to the right. Everything looks perfect eeh?
well, not really!. Its coll if the browser is maximized but if you resize(squeeze) the window the contents condense, till to the point the right bar drops to the left.
I don't want that!! Please help me.
Thanking you in advance!
I am designing a website. The site has to have 3 columns, so i floated the left bar to the left. Didn't float the main, middle content and i floated the right bar to the right. Everything looks perfect eeh?
well, not really!. Its coll if the browser is maximized but if you resize(squeeze) the window the contents condense, till to the point the right bar drops to the left.
I don't want that!! Please help me.
Thanking you in advance!
I am a Novice..............
•
•
Join Date: Nov 2007
Posts: 45
Reputation:
Solved Threads: 1
alimoe,
In the code below you see 3 columns made with divs. There is comment inside to explain what is done. In Firefox 3 and IE 6 and 7 the right div always stays at the right. All columns are made with floating divs.
In the code below you see 3 columns made with divs. There is comment inside to explain what is done. In Firefox 3 and IE 6 and 7 the right div always stays at the right. All columns are made with floating divs.
HTML and CSS Syntax (Toggle Plain Text)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <style = "text/css"> .bodywrapper {width:80%;margin-left:auto;margin-right:auto;} .wrapperleft {width:15%; float:left;} .wrappermiddle {width:70%; float:left;} .wrapperright {width:15%; float:right;} .divleft {margin:3px; padding:3px; border:1px solid red;} .divmiddle {margin:3px; padding:3px; border:1px solid green;} .divright {margin:3px; padding:3px; border:1px solid blue;} </style> </head> <body> <!-- 3 cols div's. All divs touch, total width: 100% --> <div class="wrapperleft" style="background-color:red">some text</div> <div class="wrappermiddle" style="background-color:green;">more text</div> <div class="wrapperright" style="background-color:blue;">and more</div> <br/><br/> <!-- 3 cols div's inside wrappers. Divs don't touch, total width: 100% --> <div class="wrapperleft"><div class="divleft">some text</div></div> <div class="wrappermiddle"><div class="divmiddle">more text</div></div> <div class="wrapperright"><div class="divright">and more</div></div> <br/><br/> <!-- 3 cols div's inside wrappers. Divs don't touch, total width: width off bodywrapper (80%) --> <div class="bodywrapper"> <div class="wrapperleft"><div class="divleft">some text</div></div> <div class="wrappermiddle"><div class="divmiddle">more text</div></div> <div class="wrapperright"><div class="divright">and more</div></div> </div> </body>
Last edited by colweb; Mar 5th, 2009 at 9:44 am.
•
•
•
•
hi guys,
I am designing a website. The site has to have 3 columns, so i floated the left bar to the left. Didn't float the main, middle content and i floated the right bar to the right. Everything looks perfect eeh?
well, not really!. Its coll if the browser is maximized but if you resize(squeeze) the window the contents condense, till to the point the right bar drops to the left.
I don't want that!! Please help me.
Thanking you in advance!
Failure is not an option It's included free
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
•
•
Join Date: Nov 2007
Posts: 45
Reputation:
Solved Threads: 1
almostbob,
take out the fixed sizes the colums are set at and change them to % of the window width
It is possible to have 3 cols and have the middle one fixed. See the code below. The middle column is 600px wide and the left and right 15% each. The right one will always stay right, but off course will go over the middle one if the whole window is becoming to small. Thing is, you must pay attention to the order of the divs. The floating left and right one must come before the fixed non floating middle column.
Even all the columns can have a fixed width, see the third example in the code below. But here also, the right column will go over the middle one if the window size is too small.
take out the fixed sizes the colums are set at and change them to % of the window width
It is possible to have 3 cols and have the middle one fixed. See the code below. The middle column is 600px wide and the left and right 15% each. The right one will always stay right, but off course will go over the middle one if the whole window is becoming to small. Thing is, you must pay attention to the order of the divs. The floating left and right one must come before the fixed non floating middle column.
Even all the columns can have a fixed width, see the third example in the code below. But here also, the right column will go over the middle one if the window size is too small.
HTML and CSS Syntax (Toggle Plain Text)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <style type = "text/css"> .bodywrapper {width:80%;margin-left:auto;margin-right:auto;} .wrapperleft {width:15%; float:left;} .wrappermiddle {width:600px; margin-left:auto; margin-right:auto;} .wrapperright {width:15%; float:right;} .divleft {margin:3px; padding:3px; border:1px solid red;} .divmiddle {margin:3px; padding:3px; border:1px solid green;} .divright {margin:3px; padding:3px; border:1px solid blue;} </style> </head> <body> <!-- 3 cols div's. All divs touch, total width: 100% --> <div class="wrapperleft" style="background-color:red">some text</div> <div class="wrapperright" style="background-color:blue;">and more</div> <div class="wrappermiddle" style="background-color:green;">more text</div> <br/><br/> <!-- 3 cols div's inside wrappers. Divs don't touch, total width: 100% --> <div class="wrapperleft"><div class="divleft">some text</div></div> <div class="wrapperright"><div class="divright">and more</div></div> <div class="wrappermiddle"><div class="divmiddle">more text</div></div> <br/><br/> <!-- 3 cols div's inside wrappers. Divs don't touch, total width: width off bodywrapper (80%) --> <div class="bodywrapper"> <div style="width:200px; float:left;"><div class="divleft">some text</div></div> <div style="width:200px; float:right;"><div class="divright">and more</div></div> <div class="wrappermiddle"><div class="divmiddle">more text</div></div> </div> </body> </html>
•
•
•
•
The middle column is 600px wide and the left and right 15% each
the op wants to avoid having the right div drop below the others when the window is resized, not cause further layout problems, overlays, scroll bars
This why the W3C css standard is relative sizes and postioning.
Last edited by almostbob; Mar 5th, 2009 at 2:26 pm.
Failure is not an option It's included free
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
•
•
Join Date: Nov 2007
Posts: 45
Reputation:
Solved Threads: 1
•
•
•
•
resize the window, ~500px, now the layout is 150% wide
the op wants to avoid having the right div drop below the others when the window is resized, not cause further layout problems, overlays, scroll bars
This why the W3C css standard is relative sizes and postioning.
When using fixed width's, Firefox will let the divs overlap while IE will drop the middle div below the left and right one if the window size becomes to small.
With relative width divs IE will sometimes drop the right div below the two others, but will keep it on the right. Don't know what should be the correct action, but to me it seems Firefox is doinig it right, relative and fixed always stay on the same level and fixed will eventually overlap.
![]() |
Similar Threads
- Floating/scrolling image? (JavaScript / DHTML / AJAX)
- CSS positioning problems (HTML and CSS)
- Help needed with floating nav bar css/html (HTML and CSS)
- Floating IP Address in AOL (PHP)
- Run problems. (C++)
- help needed in floating point (C++)
- Need help with the program i have written i am unable to correct the problems. please (C++)
- Hard disk problems -Fragmentation- (Windows NT / 2000 / XP)
- 200 GB Hard Drive Problems (Windows NT / 2000 / XP)
Other Threads in the HTML and CSS Forum
- Previous Thread: Open source for video tutorial
- Next Thread: View page from bottom?
| Thread Tools | Search this Thread |
appointments asp background backgroundcolor beta browser bug calendar cart cgi code codeinjection corporateidentity css design development displayimageinsteadofflash dreamweaver emailmarketing epilepsy explorer firefox flash form format google griefers hackers hitcounter hover html ide ie7 ie8 iframe image images internet internetexplorer intranet iphone javascript jpeg layout macbook maps marketshare microsoft mozilla multimedia navigationbars news offshoreoutsourcingcompany opacity opera optimization pnginie6 positioning problem scroll seo shopping studio swf swf. textcolor timecolor titletags url urlseparatedwords visual visualization web webdevelopment webform website windows7






