Floating Div Question

  • PolishHurricane
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 1585

Post 3+ Months Ago

Hello, on this page... http://blog.html.it/layoutgala/LayoutGala13.html

When you make the browser window small, how do you stop the right nav/column from overlapping the content in the center & on the left?
  • natas
  • PHP Ninja
  • Proficient
  • natas
  • Posts: 308
  • Loc: AFK

Post 3+ Months Ago

That is weird. I copy/pasted your code onto my own site and it doesn't do that. I changed nothing.

http://decklocker.com/ozzuhelp.html


EDIT:

I retract my previous statement. When it gets smaller, it shrinks the middle column until it can't anymore then it starts to overlap if you keep resizing.

What effect are you wanting to see on resize?
  • natas
  • PHP Ninja
  • Proficient
  • natas
  • Posts: 308
  • Loc: AFK

Post 3+ Months Ago

OK, I got rid of all those margins set as PX and changed them to percentages. Then I changed all 3 divs (nav, content and extra) to float:left. Then i rearranged the markup so that the "content" div appears in between the "navigation" and "extra".

Check it out now and see if that's what you're trying to accomplish.
  • Howdy_McGee
  • Novice
  • Novice
  • Howdy_McGee
  • Posts: 16

Post 3+ Months Ago

Don't change them to Percentages. Percentages make the text/divs smaller/larger depending on the window size. Pixels give it kind of a absolute whatever.

What you need to do is make some container DIVs a width, and change everything from percentages to pixels.
  • natas
  • PHP Ninja
  • Proficient
  • natas
  • Posts: 308
  • Loc: AFK

Post 3+ Months Ago

Howdy_McGee wrote:
Don't change them to Percentages. Percentages make the text/divs smaller/larger depending on the window size. Pixels give it kind of a absolute whatever.

What you need to do is make some container DIVs a width, and change everything from percentages to pixels.


They were originally pixels and it caused an overlap. That's what we are trying to fix. I am just waiting to hear if the solution I came up with is what he is looking for.
  • PolishHurricane
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 1585

Post 3+ Months Ago

I really appreciate the help, sorry for the posting delay.

Anyway, that site isn't mine, but it's exactly what I need almost. I need static px sides, but a fluid center. Which is what that thing is, except I can't deal with the right nav overlapping when the browser is reasonably small.

This is a very simplified version of what I used so far...

Code: [ Select ]
div#contentwrapper {float:left; width:100%; }
div#content { margin: 0 200px; padding: 0px 10px 0px 10px; }
div#nav1 {float:left; width:200px; margin-left:-100%; }
div#nav2 {float:left; width:200px; margin-left:-200px; }
  1. div#contentwrapper {float:left; width:100%; }
  2. div#content { margin: 0 200px; padding: 0px 10px 0px 10px; }
  3. div#nav1 {float:left; width:200px; margin-left:-100%; }
  4. div#nav2 {float:left; width:200px; margin-left:-200px; }


Code: [ Select ]
<div id="contentwrapper">
<div id="content">
  More stuff is in here...
</div>
</div>
<div id="nav1">
<!-- LEFT NAV -->
</div>
<div id="nav2">
<!-- RIGHT NAV -->
</div>
  1. <div id="contentwrapper">
  2. <div id="content">
  3.   More stuff is in here...
  4. </div>
  5. </div>
  6. <div id="nav1">
  7. <!-- LEFT NAV -->
  8. </div>
  9. <div id="nav2">
  10. <!-- RIGHT NAV -->
  11. </div>


And that stuff is within a lot of other divs. I can't really show my site cause it's not online atm.

Thanks.
  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8416
  • Loc: USA

Post 3+ Months Ago

Hey, don't do anything crazy... that code is good the way it is.

All you need is the min-width property on the #container div.

Below is the only thing that I added to the css (I have not changed anything)
CSS Code: [ Select ]
div#container{min-width: 600px}

That worked nicely.

The entire code is:
Code: [ Select ]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Layout 13</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<meta name="generator" content="HAPedit 3.1">
<style type="text/css">
html,body{margin:0;padding:0}
body{font: 76% arial,sans-serif}
p{margin:0 10px 10px}
a{display:block;color: #006;padding:10px}
div#header{position:relative}
div#header h1{height:80px;line-height:80px;margin:0;
padding-left:10px;background: #EEE;color: #79B30B}
div#header a{position:absolute;right:0;top:23px}
div#content p{line-height:1.4}
div#navigation{background:#B9CAFF}
div#extra{background:#FF8539}
div#footer{background: #333;color: #FFF}
div#footer p{margin:0;padding:5px 10px}
div#footer a{display:inline;padding:0;color: #C6D5FD}

div#wrapper{float:left;width:100%}
div#content{margin: 0 200px}
div#navigation{float:left;width:200px;margin-left:-100%}
div#extra{float:left;width:200px;margin-left:-200px}
div#footer{clear:left;width:100%}

div#container{min-width: 600px}
</style>
<script type="text/javascript" src="filler.js"></script>
</head>
<body>
<div id="container">
<div id="header"><h1>Header</h1><a href="http://blog.html.it/layoutgala/layout13.zip">download this layout</a></div>

<div id="wrapper">
<div id="content">
<p><strong>1) Content here.</strong> column long long column very long fill fill fill long text text column text silly very make long very fill silly make make long make text fill very long text column silly silly very column long very column filler fill long make filler long silly very long silly silly silly long filler make column filler make silly long long fill very.</p>
<p>very make make fill silly long long filler column long make silly silly column filler fill fill very filler text fill filler column make fill make text very make make very fill fill long make very filler column very long very filler silly very make filler silly make make column column </p>
<p>fill long make long text very make long fill column make text very silly column filler silly text fill text filler filler filler make make make make text filler fill column filler make silly make text text fill make very filler column very </p>
<p>column text long column make silly long text filler silly very very very long filler fill very fill silly very make make filler text filler text make silly text text long fill fill make text fill long text very silly long long filler filler fill silly long make column make silly long column long make very </p>
</div>
</div>
<div id="navigation">
<p><strong>2) Navigation here.</strong> long long fill filler very fill column column silly filler very filler fill fill filler text fill very silly fill text filler silly silly filler fill very make fill column text column very very column fill fill very silly column silly silly fill fill long filler </p>

</div>
<div id="extra">
<p><strong>3) More stuff here.</strong> very text make long column make filler fill make column column silly filler text silly column fill silly fill column text filler make text silly filler make filler very silly make text very very text make long filler very make column make silly column fill silly column long make silly filler column filler silly long long column fill silly column very </p>
</div>
<div id="footer"><p>The footer. You can go to the <a href="http://blog.html.it/layoutgala/">index page</a>.</p></div>
</div>
<script type="text/javascript">AddFillerLink("content","navigation","extra")</script>
</body>
</html>
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  2. <html>
  3. <head>
  4. <title>Layout 13</title>
  5. <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
  6. <meta name="generator" content="HAPedit 3.1">
  7. <style type="text/css">
  8. html,body{margin:0;padding:0}
  9. body{font: 76% arial,sans-serif}
  10. p{margin:0 10px 10px}
  11. a{display:block;color: #006;padding:10px}
  12. div#header{position:relative}
  13. div#header h1{height:80px;line-height:80px;margin:0;
  14. padding-left:10px;background: #EEE;color: #79B30B}
  15. div#header a{position:absolute;right:0;top:23px}
  16. div#content p{line-height:1.4}
  17. div#navigation{background:#B9CAFF}
  18. div#extra{background:#FF8539}
  19. div#footer{background: #333;color: #FFF}
  20. div#footer p{margin:0;padding:5px 10px}
  21. div#footer a{display:inline;padding:0;color: #C6D5FD}
  22. div#wrapper{float:left;width:100%}
  23. div#content{margin: 0 200px}
  24. div#navigation{float:left;width:200px;margin-left:-100%}
  25. div#extra{float:left;width:200px;margin-left:-200px}
  26. div#footer{clear:left;width:100%}
  27. div#container{min-width: 600px}
  28. </style>
  29. <script type="text/javascript" src="filler.js"></script>
  30. </head>
  31. <body>
  32. <div id="container">
  33. <div id="header"><h1>Header</h1><a href="http://blog.html.it/layoutgala/layout13.zip">download this layout</a></div>
  34. <div id="wrapper">
  35. <div id="content">
  36. <p><strong>1) Content here.</strong> column long long column very long fill fill fill long text text column text silly very make long very fill silly make make long make text fill very long text column silly silly very column long very column filler fill long make filler long silly very long silly silly silly long filler make column filler make silly long long fill very.</p>
  37. <p>very make make fill silly long long filler column long make silly silly column filler fill fill very filler text fill filler column make fill make text very make make very fill fill long make very filler column very long very filler silly very make filler silly make make column column </p>
  38. <p>fill long make long text very make long fill column make text very silly column filler silly text fill text filler filler filler make make make make text filler fill column filler make silly make text text fill make very filler column very </p>
  39. <p>column text long column make silly long text filler silly very very very long filler fill very fill silly very make make filler text filler text make silly text text long fill fill make text fill long text very silly long long filler filler fill silly long make column make silly long column long make very </p>
  40. </div>
  41. </div>
  42. <div id="navigation">
  43. <p><strong>2) Navigation here.</strong> long long fill filler very fill column column silly filler very filler fill fill filler text fill very silly fill text filler silly silly filler fill very make fill column text column very very column fill fill very silly column silly silly fill fill long filler </p>
  44. </div>
  45. <div id="extra">
  46. <p><strong>3) More stuff here.</strong> very text make long column make filler fill make column column silly filler text silly column fill silly fill column text filler make text silly filler make filler very silly make text very very text make long filler very make column make silly column fill silly column long make silly filler column filler silly long long column fill silly column very </p>
  47. </div>
  48. <div id="footer"><p>The footer. You can go to the <a href="http://blog.html.it/layoutgala/">index page</a>.</p></div>
  49. </div>
  50. <script type="text/javascript">AddFillerLink("content","navigation","extra")</script>
  51. </body>
  52. </html>
  • PolishHurricane
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 1585

Post 3+ Months Ago

Ah yes, I'm an idiot. I'm so used to not using that property because when it first came out, it was pretty much unsupported. I ended up just throwing a min-width: 750px on the main div for my entire site. Hopefully that's not too big. It has it's problems, but f*ck... I can't believe I didn't think of that.

Thanks
  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8416
  • Loc: USA

Post 3+ Months Ago

No problem. I don't think that 750px is too big... the 600px resolution monitors are pretty much extinct anyway.
  • PolishHurricane
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 1585

Post 3+ Months Ago

Yeah I actually referred to http://www.w3schools.com/browsers/browsers_display.asp and ended up making it 1000px. With every day the minimum resolution grows anyway.
  • whogoes
  • Novice
  • Novice
  • whogoes
  • Posts: 18

Post 3+ Months Ago

Using 1000px is a decent size. It's about time people start changing their resolutions to bigger sizes.

Post Information

  • Total Posts in this topic: 11 posts
  • Users browsing this forum: No registered users and 19 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.