Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
Fluid design with columns in percentages - AAARRRGHH!!!
Old 05-24-2009, 01:23 AM Fluid design with columns in percentages - AAARRRGHH!!!
World's Avatar
Extreme Talker

Posts: 202
Location: Santa Monica, CA
Trades: 0
I'm trying to create a fluid design.

Header, Main, Sidebar, Footer.

I don't want the sidebar to have a fixed width. That would be the easy way.

I want the site to grow and shrink proportionally depending on sceen size and resolution.

From the book "Pro CSS and HTML Design Patterns" by Michael Bowers I got a pattern for this. It's called the outside-in box.

Problem I have is that when I only use width, MAIN and SIDEBAR shrinkwrap around the text. I've put MAIN on 65% and SIDEBAR on 35%, but because there is little text, they shrink like a dried apple and are actually only 50% of the width with huge amounts of background showing through.

My key problem is: how do I get the MAIN and the SIDEBAR columns (both floated left) to actually take up their full space. I only get them to be as large as the text they contain, and this looks awful.

Any idea to define the size of a column without actually using pixels?
World is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-24-2009, 09:13 AM Re: Fluid design with columns in percentages - AAARRRGHH!!!
Novice Talker

Posts: 14
Trades: 0
I don't know if i understand correctly what is you want to do, but this worked for me (combined, the 2 div's have 100% width):

HTML Code:
<div style="width="100%; min-height: 300px; ">

    <div style="float: left; width: 65%; min-height: 300px; background-color: #99CCFF;">
    some text
    </div>

    <div style="float: left; width: 35%; min-height: 300px; background-color: #FFFFCC; ">
    some other text
    </div>

</div>
__________________

Please login or register to view this content. Registration is FREE

Last edited by netingredient; 05-24-2009 at 09:16 AM..
netingredient is offline
Reply With Quote
View Public Profile
 
Old 05-24-2009, 10:41 AM Re: Fluid design with columns in percentages - AAARRRGHH!!!
LadynRed's Avatar
Defies a Status

Posts: 10,016
Location: Tennessee
Trades: 0
So, you have to remove the shrink-wrapping functions so that the percentage-based boxes stay the width you define them to be, and that should equal 100%, as noted above.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 05-27-2009, 11:37 PM Re: Fluid design with columns in percentages - AAARRRGHH!!!
World's Avatar
Extreme Talker

Posts: 202
Location: Santa Monica, CA
Trades: 0
The problem is to combine the outside-in box model with width set to percentages that needs to nest four divs into each other.
______________



<div id="middle_section"> this contains both the "main" section and the "sidebar" section. set to 100%.

<div id="container_main_container"> set to 65%, so it only takes 65% of the width.
<div id="main_container"> this is set to 100% to ensure that all the main div, including padding, is included in the width.
<div id="main" > here's the actual mark-up for main.
</div>
</div>
</div>

<div id="container_sidebar_container"> set to 35%, so it only takes 35% of the width.
<div id="sidebar_container"> this is set to 100% to ensure that all the main div, including padding, is included in the width.
<div id="sidebar" > here's the actual mark-up for sidebar.
</div>
</div>
</div>

</div> closing the div of "middle section" which wraps "main" and "sidebar".


_______________

It's probably overly complex, but it's logical.

1. First you have a div "main" that includes all the mark-up, including the non-scalable paddings and borders.

2. Then you put a div around and set this to 100%. This includes all the paddings and borders in a 100% unit, and so makes everything scalable.

3. Then you put another div around, and set it to 65%. So, these 100% of "main" will only take 65% of width.

4. Then you put another div "middle" around "main" and "sidebar" and set it to 100%, so "main" would be 65% of these 100%, and "sidebar" 35%.

But it's still shrinkwrapping.

What I wrote passed the validator for both XHTML and CSS, but it doesn't work.



PS: In future I will use em for padding and margins for scalability. But it puzzles me why this one doesn't work and all this stuff doesn't stop shrinkwrapping. At the moment it doesn't even get "main" and "sidebar" next to each other. They exceed the 100% and go in line underneath each other, and shrinkwrapped.

Last edited by World; 05-28-2009 at 12:09 AM..
World is offline
Reply With Quote
View Public Profile
 
Old 05-28-2009, 02:32 AM Re: Fluid design with columns in percentages - AAARRRGHH!!!
World's Avatar
Extreme Talker

Posts: 202
Location: Santa Monica, CA
Trades: 0
Well, I got it to work.

The trick was to put the float element not in the innermost level.

Because the float is not in the "main" div but in its container, the shrinkwrapping stops.

I have also fully scalable boxes that can be defined by percentages, because the borders, padding, etc. is included due to the container.

What's left to do:

One of the two columns is shorter than the other. I have to find a possibility to stretch it to the same size the longer column has.

Not sure if that's possible.
World is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Fluid design with columns in percentages - AAARRRGHH!!!
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 1.06592 seconds with 12 queries