tallberg Posted June 15, 2007 Share Posted June 15, 2007 Hi i keep coming up against the same problem. I would like a box to wrap arround an image and text that is on the next line. I dont want to set the size of a div becuase image could be of varing size A span only wraps the text. a p has the same problem as the div. Pls help Quote Link to comment Share on other sites More sharing options...
Gafaddict Posted June 16, 2007 Share Posted June 16, 2007 Put the box and text in a div and create a class for it with the attribute: border: 1px solid #000000; 1px can be changed depending on how wide you want the border to be; the same goes for the color of course. Quote Link to comment Share on other sites More sharing options...
AndyB Posted June 16, 2007 Share Posted June 16, 2007 If you're describing an image and caption inside a 'box' - look here->http://www.w3.org/Style/Examples/007/figures.html Quote Link to comment Share on other sites More sharing options...
tallberg Posted June 16, 2007 Author Share Posted June 16, 2007 Im using images of a variable size. So setting the div width is not and option. How do get round that one. I need the box to wrap arroound the image and text. Quote Link to comment Share on other sites More sharing options...
dj-kenpo Posted June 16, 2007 Share Posted June 16, 2007 use php. get the dimension of the image, then ADD some space. eg, if you want an extra say 200px of space and the image is 300 wide, then php tells the width to be 500. just define the width in the div with the style command instead of at the top of your page in in a css file. Quote Link to comment Share on other sites More sharing options...
bronzemonkey Posted June 16, 2007 Share Posted June 16, 2007 What do you want to use this for? Is it a photo gallery? Is it for photographs to be included on pages containing text? If there is other text do you want this to wrap around the photo/caption? Do the images vary unpredictably in size or just between two or three different sizes? How big are the differences in size between photographs? Quote Link to comment Share on other sites More sharing options...
AndyB Posted June 16, 2007 Share Posted June 16, 2007 use php. get the dimension of the image, then ADD some space http://ca.php.net/manual/en/function.getimagesize.php in case you need the reference Quote Link to comment Share on other sites More sharing options...
mainewoods Posted June 16, 2007 Share Posted June 16, 2007 set the size of your div smaller than the graphic would ever be, and then the graphic will force the div to it's size: <div style="width:10px;float:left"> <img src="url"><br> some text here! </div> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.