Results 1 to 2 of 2
Sep 11, 2004, 14:20 #1
- Join Date
- Aug 2004
- Swarthmore, PA
- 0 Post(s)
- 0 Thread(s)
Need DIV to magically assume correct width for content
Essentially, I have a containing block, which holds the main text of the page along with an occassional image. I need to right-align a short photo credit under any images that appear. To do this, I have thrown the image and the photo credit in a div with class imagebox.
However, my imageboxes automatically fill the width of the containing block, leaving the photo credit way out to the right of the image. Setting a width on imagebox fixes the problem, but since my images will vary in width, I'd have to do some nasty scripting to get that fix to work consistently.
So my question: is there any way to get a div (or any block, for that matter) to shrink to the minimum width needed for its content? I know span tags do this by default, but at least in Firefox, spans fill the minimum width for each line, so that won't help me align text under an image.