例如有table如下:
<table>
<tr>
<td id="a"><img id="pic" src="p.jpg" onclick="b()"/></td>
</tr>
</table>
请问如何在表格a中添加文字,并且把图片pic作为背景呢?
谢谢!

解决方案 »

  1.   


    <!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> 
    <title>无标题页 </title> 
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <style type="text/css">
    #a{background:url(u=810583903,2119698940&fm=0&gp=48.jpg) no-repeat;}
    </style>
    </head> 
    <body> 
        <table> 
    <tr> 
    <td id="a">aaaa </td> 
    </tr> 
    </table>
    </body> 
    </html>
      

  2.   


    <table> 
    <tr> 
    <td id="a" style="position:relative"><img id="pic" src="p.jpg" onclick="b()"/><span style="position:absolute">asdfasdfadsf</span></td> 
    </tr> 
    </table> 
      

  3.   

    要求不能用background,只能用img,并且文字显示在图像上面。
      

  4.   

    <table> 
    <tr> 
    <td id="a"><img id="pic" style="position:absolute" src="p.jpg" onclick="b()"/><span style="position:absolute">asdfasdfadsf</span></td> 
    </tr> 
    </table> 
      

  5.   


    <!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>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    </head><body>
    <table> 
    <tr> 
    <td id="a"><div style="position:relative;"><img id="pic" src="u=3269771209,644599384&fm=0&gp=44.jpg" /><span style="position:absolute; left:0; top:0;">asdfasdfadsf</span></div></td> 
    </tr> 
    </table>
    </body>
    </html>
      

  6.   

    这要求奇葩了还不让用background
      

  7.   

    添加一个浮动层就行了
    <td><div style="position:absolute;">Text</div><img id="pic" src="u=3269771209,644599384&fm=0&gp=44.jpg" /></td>
      

  8.   

    用css层
    z-index 可以做到,还要加上position属性值用相对就可以了