Go Back   Velocity Reviews > Newsgroups > HTML
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

HTML - CSS: Squeezing DIVs Together

 
Thread Tools Search this Thread
Old 04-27-2004, 08:39 PM   #1
Default CSS: Squeezing DIVs Together


Here's what I'm trying to do in IE 6+. I have 3 blocks:

<div id="DIV1">
</div>
<div id="DIV2">
</div>
<div id="DIV3">
</div>

I want them to look like this:
________________________________________
|****** ****** ******|
|* * * * * *|
|*DIV1* *DIV2* *DIV3*|
|* * * * * *|
|* * * * * *|
|****** ****** ******|

Where DIV 1 and 2 are floated left and DIV 3 is floated right.

The CSS I have created to do this is

#DIV1 {
float: left;
}
#DIV2 {
float: left;
}
#DIV3 {
float: right;
}

This works great, except that when a user reduces the size of the
window horizontally, if the DIVs touch each other, the second one
falls below the first one. I'm sure this is by design. What I want
is for the DIVs just to squeeze as close as possible to each other and
then stop, causing the horizontal toolbar to appear on the browser
window, similar to how a table cell works (maybe I should use a table
cell here, but I'm trying to get away from using tables for
positioning).

Any suggestions?

Thanks,
Leo Hart


Leo J. Hart IV
  Reply With Quote
Old 04-27-2004, 10:32 PM   #2
brucie
 
Posts: n/a
Default Re: CSS: Squeezing DIVs Together

in post: <news:. com>
(Leo J. Hart IV) said:

> What I want is for the DIVs just to squeeze as close as possible to
> each other and then stop, causing the horizontal toolbar to appear on
> the browser window,


min-widthxxx

not supported by IE.

IE fix:
http://www.doxdesk.com/software/js/minmax.html
http://www.svendtofte.com/code/max_width_in_ie/

--
b r u c i e


  Reply With Quote
Old 04-28-2004, 02:53 PM   #3
Leo J. Hart IV
 
Posts: n/a
Default Re: CSS: Squeezing DIVs Together

Thanks, these links will be very useful. However, min-width requires
that I know the size of the contents within the DIV. What happens if
I do not know this (which is the case)? Is there another way?

Thanks,
Leo



brucie <****@bruciesusenetshit.info> wrote in message news:<c6mjdv$dor93$>...
> in post: <news:. com>
> (Leo J. Hart IV) said:
>
> > What I want is for the DIVs just to squeeze as close as possible to
> > each other and then stop, causing the horizontal toolbar to appear on
> > the browser window,

>
> min-widthxxx
>
> not supported by IE.
>
> IE fix:
> http://www.doxdesk.com/software/js/minmax.html
> http://www.svendtofte.com/code/max_width_in_ie/

  Reply With Quote
Old 04-28-2004, 03:07 PM   #4
brucie
 
Posts: n/a
Default Re: CSS: Squeezing DIVs Together

in post: <news:. com>
(Leo J. Hart IV) said:

>>> What I want is for the DIVs just to squeeze as close as possible to
>>> each other and then stop, causing the horizontal toolbar to appear on
>>> the browser window,


>> min-widthxxx
>> not supported by IE.
>> IE fix:
>> http://www.doxdesk.com/software/js/minmax.html
>> http://www.svendtofte.com/code/max_width_in_ie/


> Thanks, these links will be very useful. However, min-width requires
> that I know the size of the contents within the DIV.


no it doesn't, it just suggests the minimum width for it.

> What happens if I do not know this (which is the case)? Is there
> another way?


you must have some idea what is going to go in the <div>s. decide on the
minimum width that is acceptable for that content. for example if its
text then the min width should be greater than just a few words. if its
an image then it should be equal or greater than the image width.

your <div>s are floated so you must have come to some decision on their
width, now all you need to do is decide what their min width should be
that will still maintain your look. simple.

please don't toppost, it upsets the little voices

How am I supposed to post my replies in a newsgroup?:
http://allmyfaqs.com/faq.pl?How_to_post

--
b r u c i e


  Reply With Quote
Old 04-28-2004, 03:11 PM   #5
brucie
 
Posts: n/a
Default Re: CSS: Squeezing DIVs Together

in post: <news:c6odoo$eh9h8$>
brucie <****@bruciesusenetshit.info> said:

> your <div>s are floated so you must have come to some decision on their
> width, now all you need to do is decide what their min width should be
> that will still maintain your look. simple.


i got so excited babbling i forgot the important bit. the min width goes
on the element containing the three floated <div>s. if they're not in an
element it may be a good idea to stick them in one.


--
b r u c i e


  Reply With Quote
Old 04-28-2004, 03:38 PM   #6
brucie
 
Posts: n/a
Default Re: CSS: Squeezing DIVs Together

in post: <news:c6odvo$eh9h8$>
brucie <****@bruciesusenetshit.info> said:

> i got so excited babbling i forgot the important bit. the min width goes
> on the element containing the three floated <div>s. if they're not in an
> element it may be a good idea to stick them in one.


a demo: http://moreshit.bruciesusenetshit.in...th-thingy.****

--
b r u c i e


  Reply With Quote
Old 04-28-2004, 04:23 PM   #7
Whitecrest
 
Posts: n/a
Default Re: CSS: Squeezing DIVs Together

In article <>,
says...
> Thanks, these links will be very useful. However, min-width requires
> that I know the size of the contents within the DIV. What happens if
> I do not know this (which is the case)? Is there another way?


Unless the user is putting things on your site, how can not not know the
(physical) size of everything that you write to the browser? It is your
code.

--
Whitecrest Entertainment
www.whitecrestent.com
  Reply With Quote
Old 04-28-2004, 07:38 PM   #8
Grahammer
 
Posts: n/a
Default Re: CSS: Squeezing DIVs Together


"Whitecrest" <> wrote in message
news:.. .
> In article <>,
> says...
> > Thanks, these links will be very useful. However, min-width requires
> > that I know the size of the contents within the DIV. What happens if
> > I do not know this (which is the case)? Is there another way?

>
> Unless the user is putting things on your site, how can not not know the
> (physical) size of everything that you write to the browser? It is your
> code.


Never heard of dynamic content?

....and I do personally have sites that have attributes that the user can
alter.


  Reply With Quote
Old 04-28-2004, 08:14 PM   #9
Whitecrest
 
Posts: n/a
Default Re: CSS: Squeezing DIVs Together

In article <jSSjc.298089$oR5.46886@pd7tw3no>, postmaster@127.0.0.1
says...
> > Unless the user is putting things on your site, how can not not know the
> > (physical) size of everything that you write to the browser? It is your
> > code.

> Never heard of dynamic content?


Even though I DISPLAY content dynamically, I already know the size of
everything. Dynamic or not, it is still my content. (with the exception
of allowing the user to upload things)
--
Whitecrest Entertainment
www.whitecrestent.com
  Reply With Quote
Reply


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

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