OZONE Asylum
Forums
XML - XSL - XSLT - XHTML - CSS - DOM
Contrain DIV Width to IMG Width
This page's ID:
11052
Search
QuickChanges
Forums
FAQ
Archives
Register
Edit Post
Who can edit a post?
The poster and administrators may edit a post. The poster can only edit it for a short while after the initial post.
Your User Name:
Your Password:
Login Options:
Remember Me On This Computer
Your Text:
Insert Slimies »
Insert UBB Code »
Close
Last Tag
|
All Tags
UBB Help
If you have PHP available you can do this easily. basically you would use the [url=http://us2.php.net/manual/en/function.getimagesize.php]getimagesize()[/url] function to return a variable containing the width of the image. We'll name the variable '$width' Then in your caption div, call that variable in a style declaration - <div class="caption" style="width:<? $width ?>;"> Other than that, I can't think of a pure HTML/CSS solution besides a table... Of course, if you are hard coding the page and the image, it would be a simple matter to simply add the style="width:...;" part to the caption <div> to match the image's width anyway, especially since you need to type it for the <img> already.... [This message has been edited by DL-44 (edited 09-22-2003).] [This message has been edited by DL-44 (edited 09-22-2003).]
Loading...
Options:
Enable Slimies
Enable Linkwords
« Backwards
—
Onwards »
Maximum Security
OZONE
DHTML/Javascript
Server-Side Scripting - Oh my!
CSS - DOM - XHTML - XML - XSL - XSLT
Stupid Basic HTML
Visual Therapy
Photoshop
Photoshop Pong, Anyone?
***WARNING*** BIG SIG APPROACHING
Photography
3D Modelling & Rendering
Multimedia/Animation
Print Graphics
Holding Pens
Philosophy and other Silliness
Outpatient Counseling
Site reviews!
Mad Scientists' Laboratory
Getting to know the Grail