例如有table如下:
<table>
<tr>
<td id="a"><img id="pic" src="p.jpg" onclick="b()"/></td>
</tr>
</table>
请问如何在表格a中添加文字,并且把图片pic作为背景呢?
谢谢!
<table>
<tr>
<td id="a"><img id="pic" src="p.jpg" onclick="b()"/></td>
</tr>
</table>
请问如何在表格a中添加文字,并且把图片pic作为背景呢?
谢谢!
<!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>
<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>
<tr>
<td id="a"><img id="pic" style="position:absolute" src="p.jpg" onclick="b()"/><span style="position:absolute">asdfasdfadsf</span></td>
</tr>
</table>
<!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>
<td><div style="position:absolute;">Text</div><img id="pic" src="u=3269771209,644599384&fm=0&gp=44.jpg" /></td>
z-index 可以做到,还要加上position属性值用相对就可以了