如何在asp.net中使用div标签显示图像

时间:2012-08-13 07:45:10

标签: asp.net

net,我想使用div标签显示图像。我正在使用以下div来做到这一点。我的div是

<div style="background: transparent url('arrow_left.png') no-repeat center center; width:32px; height: 32px;"></div>

2 个答案:

答案 0 :(得分:0)

这个对我有用:

 <div style="background: transparent  url('http://cdn.sstatic.net/stackoverflow/img/sprites.png?v=5') no-repeat  top left; width:132px; height: 132px;"></div>

->使用速记属性时,属性值的顺序为:

background-color
background-image
background-repeat
background-attachment
background-position

http://jsbin.com/upudow/2/edit

答案 1 :(得分:0)

检查一下:

  1. 图片存在(尝试使用普通<img>
  2. 检查div是否实际具有宽度和高度,您可以使用FireBug或本机浏览器调试工具。
  3. 您是否在某些用户控件中使用此Div?检查好路径问题