scotto Posted October 5, 2006 Share Posted October 5, 2006 Is there a way to define a generic div container so its width is dictated by an image placed inside it?For example:CSS div.mydiv {...} HTML ...<div class="mydiv"> <img src="myimage" /> ...</div>... So, say my image was 340px wide, that would be the width of the div. The idea being, if the div also contained text, that text would wrap, and stay within the bounds of the images width. Maybe handy for displaying images with captions.I want to avoid making custom div's of specific widths.Thanks,Scott Link to comment Share on other sites More sharing options...
aspnetguy Posted October 5, 2006 Share Posted October 5, 2006 you would have to use javascript to measure the width of the image then resize the div. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now