HighDots Forums  

OT: CSS - dynamic div widths

Macromedia Dreamweaver Macromedia Dreamweaver Discussions (macromedia.dreamweaver)


Discuss OT: CSS - dynamic div widths in the Macromedia Dreamweaver forum.



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

Default OT: CSS - dynamic div widths - 07-09-2004 , 01:19 AM






I frequently have images on press release pages. The images vary in
width, and usually have a cut-line/caption and are floated right. I
would like to create a style to format the div that and stretch or
shrink to the appropriate width. Is there any way of doing this?
Specifying a div width of zero appears to work, but is it the right way
of doing it?

Thanks,
John


Reply With Quote
  #2  
Old   
jojo
 
Posts: n/a

Default Re: OT: CSS - dynamic div widths - 07-09-2004 , 03:14 AM






Hi John

You might find that not setting a width or height would be better. The
div will then adjust to its contents.


--
Cheers jojo
Team Macromedia Member Volunteer for Dreamweaver MX
http://www.webade.co.uk
----------------------------------------------------
Extending Knowledge, Daily.
http://www.communityMX.com/
Free 10 day trial
http://www.communitymx.com/joincmx.cfm
----------------------------------------------------

Reply With Quote
  #3  
Old   
Joe {RoastHorse}
 
Posts: n/a

Default Re: OT: CSS - dynamic div widths - 07-09-2004 , 05:50 AM



in fact it will fill the available width, floated divs tend to
shrink-wrap the content but i believe this is a grey area of the specs
and some browsers don't. john: setting your width to 0 will mean that in
compliant browsers it is exactly 0 but PC IE will expand to fit the
contents.

joe





jojo wrote:
Quote:
Hi John

You might find that not setting a width or height would be better. The
div will then adjust to its contents.



Reply With Quote
  #4  
Old   
Michael Fesser
 
Posts: n/a

Default Re: OT: CSS - dynamic div widths - 07-09-2004 , 10:36 AM



.oO(John Elftmann)

Quote:
I frequently have images on press release pages. The images vary in
width, and usually have a cut-line/caption and are floated right.
I do the same on one of my pages. The images are surrounded by a div-
container, so I'm able to put a caption beneath the image and float the
entire thing around.

Quote:
I
would like to create a style to format the div that and stretch or
shrink to the appropriate width. Is there any way of doing this?
I use a server-side script for this (PHP). It gets the image size from
the file and applies it as inline-CSS to my image container.

OK, to be more precise, the code is generated from an XML document and
first looks something like this:

<div class="image" style="width: ::width::imagename::">
<img src="..." alt="...">
<p>caption</p>
</div>

The ::width::imagename:: is then replaced by PHP with the width of the
image.

Quote:
Specifying a div width of zero appears to work, but is it the right way
of doing it?
I don't think so.

Micha


Reply With Quote
  #5  
Old   
John Elftmann
 
Posts: n/a

Default Re: OT: CSS - dynamic div widths - 07-10-2004 , 10:25 AM



Quote:
You might find that not setting a width or height would be better. The
div will then adjust to its contents.
Yes, but my photo captions are frequently wider than the photo, thereby
widening the div to the width of the caption or full-screen, rather than
restricting it to the width of the photo.

John


Reply With Quote
  #6  
Old   
John Elftmann
 
Posts: n/a

Default Re: OT: CSS - dynamic div widths - 07-10-2004 , 10:52 AM



Quote:
I use a server-side script for this (PHP). It gets the image size from
the file and applies it as inline-CSS to my image container.

OK, to be more precise, the code is generated from an XML document and
first looks something like this:

div class="image" style="width: ::width::imagename::"
img src="..." alt="..."
p>caption</p
/div

The ::width::imagename:: is then replaced by PHP with the width of the
image.
Yeah, I considered this type of solution but was hoping to avoid it. I
may end up going this route.

Thanks,
John



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 - 2009, Jelsoft Enterprises Ltd.