Hi,
The only reliable way cross-browser is to use a table for this.
e.g.
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
.test {
float:left;
padding:5px;
margin:10px;
border:1px solid #000;
}
p{
width:80%;
background:red;
margin:0 auto;
text-align:center;
}
table{
width:1px;
text-align:center;
}
</style>
</head>
<body>
<div class="test">
<table>
<tr>
<td><img src="images/small.jpg" alt="" width="100" height="90" />
<p>Testing this caption to see what happens</p></td>
</tr>
</table>
</div>
</body>
</html>
You can do it for most browser except IE by using some advanced techniques.
http://www.pmob.co.uk/search-this/stcaption2.htm
However IE won't wrap the captions.
Bookmarks