日期:2014-05-17 浏览次数:20664 次
<html> <head> <title></title> <style type="text/css"> li {float: left; margin-bottom: 10px; border:1px solid gray;width: 202px;} img {margin:10px 10px 0 10px;background:red;width:180px;height:180px;border:1px solid blue;} p {padding: 10px;line-height:24px;font-size:12px;color:yellow;text-align:center;} </style> </head> <body> <ul style="margin: 0 auto; width: 204px;overflow:hidden;"> <li> <img src="" /> <p>123123123123123<br/>123123123123123<br/>123123123123123<br/></p> </li> <li> <img src="" /> <p>123123123123123<br/>123123123123123<br/>123123123123123<br/></p> </li> </ul> </body> </html>
------解决方案--------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> New Document </title>
<style>
*{margin:0;padding:0;}
</style>
</head>
<body >
<div class="">
<dl>
<dt style="width:60px; height:45px; background:red;"><img src="../images/im.jpg"></dt>
<dd>我在图片的下面</dd>
</dl>
</div>
</body>
</html>
我的觉得用dl实现更加符合html语义化;