HighDots Forums  

div as small as possible

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


Discuss div as small as possible in the Cascading Style Sheets forum.



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

Default div as small as possible - 10-29-2007 , 05:29 AM






usually i don't care... but if I use script.aculo.us, there is a
Draggable class to use so that I can drag the div around...

so the div turns out to enclose the max width across the screen. it
can make the Draggable a bit weird if I just want a small area to be
included -- one small element can overlap the other ones easily as the
div is "max width"

so I wonder, can I set the div to be "as small as possible", just to
contain the elements inside but not more.

I tried using width: auto and it wouldn't work. setting width to a
small number like 30px seems to work alright, except it maybe better
to let it just enclosed the elements inside but not more.


Reply With Quote
  #2  
Old   
Ben C
 
Posts: n/a

Default Re: div as small as possible - 10-29-2007 , 05:47 AM






On 2007-10-29, Summercool <Summercoolness (AT) gmail (DOT) com> wrote:
Quote:
usually i don't care... but if I use script.aculo.us, there is a
Draggable class to use so that I can drag the div around...

so the div turns out to enclose the max width across the screen. it
can make the Draggable a bit weird if I just want a small area to be
included -- one small element can overlap the other ones easily as the
div is "max width"

so I wonder, can I set the div to be "as small as possible", just to
contain the elements inside but not more.

I tried using width: auto and it wouldn't work. setting width to a
small number like 30px seems to work alright, except it maybe better
to let it just enclosed the elements inside but not more.
You need an element whose auto width is shrink-to-fit. That's anything
with position: absolute or fixed, or that's floated, or display:
table-cell or table.

Not completely sure exactly what you're doing, but position: absolute
with width: auto (the default) sounds like the most appropriate.


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

Default Re: div as small as possible - 10-29-2007 , 06:16 AM



On Oct 29, 3:47 am, Ben C <spams... (AT) spam (DOT) eggs> wrote:

Quote:
You need an element whose auto width is shrink-to-fit. That's anything
with position: absolute or fixed, or that's floated, or display:
table-cell or table.

Not completely sure exactly what you're doing, but position: absolute
with width: auto (the default) sounds like the most appropriate.
i tried both display: table and float: left and they both worked!
is there a rule? that when is it "max width" and when is it "just
shrink to fit"?

the display: table feels a bit weird as it is not really a table.

besides, the height seems just a little bit taller than it is...

http://www.0011.com/test_drag/index3.php

on IE 7.0, it is exactly the right size... but on Firefox 2.0.0.8 and
Safari 3 Win Beta, it is shown as a bit taller than it has to be. (as
you see the background color coming out at the bottom).






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.