日期:2014-05-17  浏览次数:20617 次

怎样让div中的img居中
<div>
asdfasfasfasfdasdfdfasfsdf
<img src...>
</div>

文字不居中,仅仅图片居中(非垂直)

------解决方案--------------------
HTML code

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>xxxxxxx</title>
    <style type="text/css">
    <!--
    div {
         text-align:center;
         width:500px; 
         height:500px; 
         border:1px solid #666666;
     
     }
     div span{
      margin:0px;
      padding:0px;
      display:block;
      margin-left:-290px;
      }
           
    -->
</style>
</head>
<body>
<div> 
<span>asdfasfasfasfdasdfdfasfsdf</span> 
<img src="11.jpg"> 
</di
  
</body>
</html>