我想使用 css 类将可点击的图像添加到 asp mvc 2 应用程序中的锚标记,并将 url 部分留空(因为我有 JavaScript 代码来加载基于给定锚标记的 id 的弹出窗口)。
目前我的代码是:
<%= Html.ImageActionLink(null, null, "~/UI/Forms/Css/Images/get-reservation.png", null, new { @Id = "getReservation" }, new { @Class = "image" })%>
信息:我添加了 ID,因为我使用 javascript 在单击 getReservation id 时加载弹出窗口。图像类只是添加了填充。
当前的CSS代码:
.image
{
padding-left: 10px;
}
我想要的是:
从我的 ImageActionLink 助手中删除以下路径
“~/UI/Forms/Css/Images/get-reservation.png”
并定义一个 CSS 类:
.get-reservation
{
background: url('images/get-reservation.png') no-repeat center;
height: 20px;
width:20px;
}
并做这样的事情:
<%= Html.ActionLink("#", null, new { @Class = "get-reservation image" }, new { @Id = "getReservation" })%>
但是我在浏览器中得到的是这样的:(并且图像无法出现。)
预期结果:
任何帮助表示赞赏。
谢谢