View Full Version : Set div width to fit content
1st September 06, 08:31 AM
Is it possible to have a fluid div width that would expand/contract to suit the content. For example a header div that would expand to 740px with a 740px header image or would expand to 640px with a 640px image? I know it is possible with tables but can this been done with css?
1st September 06, 11:04 AM
If I understand you correctly you want a div that will expand to fit an image. Thde only way I can think of off the top of my head would be:
<img src="#" alt="demo" width="200" height="100" />
float:left; /*This will cause it to wrap around it's content*/
I think that should work. You can obviously add other properties to it to ensure that it fits correctly in your site.
Hope that helps
vBulletin® v3.8.4, Copyright ©2000-2013, Jelsoft Enterprises Ltd.