HighDots Forums  

divs vs tables; overflow without scrollbars

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss divs vs tables; overflow without scrollbars in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
kaeli
 
Posts: n/a

Default divs vs tables; overflow without scrollbars - 08-03-2004 , 11:22 AM







I've been trying to get away from using tables as a layout tool, but I've
just come across what I consider to be a serious liability.
If I specify a width (minimum, really) in a div, such as

#body {
width: 90%;
margin-left: 5%;
margin-right: 5%;
border: 1px solid navy;
padding: 10px;
}

And then I put a table in that div, when the table data gets too large, it
runs outside the box instead of the box expanding. I understand that this is
expected behavior (though IE will indeed expand the box, other browsers
implement the "correct" behavior and either cut off the content or expand it
beyond the box depending on my overflow setting). If I set the overflow to
auto, I get ugly scroll bars. I don't like it.
If I use a table instead, and put a table inside, the containing table
expands.

Is there a way to get that behavior with divs or am I out of luck on this
one?
To clarify, I want a box with a border that usually takes up 90% of the
window, but expands if the content inside is too big to fit. I could use a
table, but would like to use a div/CSS if I can.

TIA

--
--
~kaeli~
Do not taunt Happy Fun Ball!
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace


Reply With Quote
  #2  
Old   
Claire Tucker
 
Posts: n/a

Default Re: divs vs tables; overflow without scrollbars - 08-03-2004 , 12:19 PM






On Tue, 3 Aug 2004 10:22:33 -0500, kaeli <tiny_one (AT) NOSPAM (DOT) comcast.net>
wrote:

Quote:
I've been trying to get away from using tables as a layout tool, but I've
just come across what I consider to be a serious liability.
If I specify a width (minimum, really) in a div, such as

#body {
width: 90%;
margin-left: 5%;
margin-right: 5%;
border: 1px solid navy;
padding: 10px;
}

If you mean "minimum width" then you really want the min-width
property, but sadly that's not supported in Internet Explorer.

My usual strategy is to either just ignore IE completely and let it
get it "almost right" (normally the content will shove the box out
anyway) or to play some tricks on IE's flakey CSS parser so that it
sees different rules to everything else.

In think in your case the first is the better plan, because at least
then your DIV box will expand to contain whatever you put inside it,
even if it does end up a little wider than what you really wanted.

Up to you, though!

All the best,
-Claire


Reply With Quote
  #3  
Old   
Spartanicus
 
Posts: n/a

Default Re: divs vs tables; overflow without scrollbars - 08-03-2004 , 12:54 PM



kaeli <tiny_one (AT) NOSPAM (DOT) comcast.net> wrote:

Quote:
To clarify, I want a box with a border that usually takes up 90% of the
window, but expands if the content inside is too big to fit. I could use a
table, but would like to use a div/CSS if I can.
Add "display:table" to your #body rules.

--
Spartanicus


Reply With Quote
  #4  
Old   
kaeli
 
Posts: n/a

Default Re: divs vs tables; overflow without scrollbars - 08-03-2004 , 01:56 PM



In article
<7fgvg0t2j8t8jbnml4bl0vn8ad2dmohtir (AT) news (DOT) spartanicus.utvinternet.ie>,
me (AT) privacy (DOT) net enlightened us with...
Quote:
kaeli <tiny_one (AT) NOSPAM (DOT) comcast.net> wrote:

To clarify, I want a box with a border that usually takes up 90% of the
window, but expands if the content inside is too big to fit. I could use a
table, but would like to use a div/CSS if I can.

Add "display:table" to your #body rules.


Sweet!!
Excellent.
Worked like a charm, at least in IE6 and NN7. I didn't test other browsers,
as this is an intranet app.

Thanks a lot!

--
--
~kaeli~
Any sufficiently advanced technology is indistinguishable
from magic.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace



Reply With Quote
  #5  
Old   
Claire Tucker
 
Posts: n/a

Default Re: divs vs tables; overflow without scrollbars - 08-03-2004 , 03:54 PM



On Tue, 3 Aug 2004 12:56:04 -0500, kaeli <tiny_one (AT) NOSPAM (DOT) comcast.net>
wrote:

Quote:
In article
7fgvg0t2j8t8jbnml4bl0vn8ad2dmohtir (...utvinternet.ie>,
me (AT) privacy (DOT) net enlightened us with...
kaeli <tiny_one (AT) NOSPAM (DOT) comcast.net> wrote:

To clarify, I want a box with a border that usually takes up 90% of the
window, but expands if the content inside is too big to fit. I could use a
table, but would like to use a div/CSS if I can.

Add "display:table" to your #body rules.



Sweet!!
Excellent.
Worked like a charm, at least in IE6 and NN7. I didn't test other browsers,
as this is an intranet app.

It worked in IE6?! I've never seen CSS tables work in IE6 before.

I'd verify this for myself, but unfortunately (or perhaps
fortunately!) I'm not using Windows at the moment.

All the best,
-Claire


Reply With Quote
  #6  
Old   
Steve Pugh
 
Posts: n/a

Default Re: divs vs tables; overflow without scrollbars - 08-03-2004 , 04:24 PM



Claire Tucker <fake (AT) invalid (DOT) invalid> wrote:
Quote:
kaeli <tiny_one (AT) NOSPAM (DOT) comcast.net> wrote:
me (AT) privacy (DOT) net enlightened us with...
kaeli <tiny_one (AT) NOSPAM (DOT) comcast.net> wrote:

To clarify, I want a box with a border that usually takes up 90% of the
window, but expands if the content inside is too big to fit. I could use a
table, but would like to use a div/CSS if I can.

Add "display:table" to your #body rules.

Worked like a charm, at least in IE6 and NN7. I didn't test other browsers,
as this is an intranet app.

It worked in IE6?! I've never seen CSS tables work in IE6 before.
display: table; is ignored in IE6, but IE6 was already 'working'
because it incorrectly treated the width as a min-width. Hence, only
those browsers that support display: table; actually 'needed' it in
this case.

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <steve (AT) pugh (DOT) net> <http://steve.pugh.net/>


Reply With Quote
  #7  
Old   
Spartanicus
 
Posts: n/a

Default Re: divs vs tables; overflow without scrollbars - 08-03-2004 , 04:46 PM



Claire Tucker <fake (AT) invalid (DOT) invalid> wrote:

Quote:
To clarify, I want a box with a border that usually takes up 90% of the
window, but expands if the content inside is too big to fit. I could use a
table, but would like to use a div/CSS if I can.

Add "display:table" to your #body rules.

Sweet!!
Excellent.
Worked like a charm, at least in IE6 and NN7. I didn't test other browsers,
as this is an intranet app.

It worked in IE6?! I've never seen CSS tables work in IE6 before.
No it doesn't work in IE, but the OP was having trouble with "other
browsers", IE already did it's famous "what the author wanted" thing,
and since IE ignores the display:table rule the poor ole thang wasn't
harmed.

--
Spartanicus


Reply With Quote
  #8  
Old   
kaeli
 
Posts: n/a

Default Re: divs vs tables; overflow without scrollbars - 08-03-2004 , 04:47 PM



In article <11tvg0tr6sbbmf8nhad2btakjqbbg4jc4c (AT) 4ax (DOT) com>, steve (AT) pugh (DOT) net
enlightened us with...
Quote:
display: table; is ignored in IE6, but IE6 was already 'working'
because it incorrectly treated the width as a min-width. Hence, only
those browsers that support display: table; actually 'needed' it in
this case.

I figured that was the case. Thanks for the clarification.

--
--
~kaeli~
The man who fell into an upholstery machine is fully
recovered.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace



Reply With Quote
Reply




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.