如何避免动作链接中的文本

时间:2013-05-19 14:39:14

标签: asp.net-mvc asp.net-mvc-3 asp.net-mvc-4 actionlink

@Ajax.ActionLink("&nbsp","Delete", "FinancialIntermediary", 
                 new { id = item.FinancialIntermediaryID }, 
                 new AjaxOptions { HttpMethod = "GET", 
                                   OnSuccess = "DeleteSuccessFI", 
                                   Confirm = "are you sure to perform the deletion." },
                 new { @class="classname" })  

css文件是

.classname
 {
    background-image:url('../../Images/delete.png');
 }

我使用上面的代码设置删除背景图片。

通过这样做,我无法避免文本。就像这样 enter image description here

我只想在那个地方拍照。请帮忙

1 个答案:

答案 0 :(得分:2)

而不是使用 只需使用空格:

@Ajax.ActionLink(" ","Delete", "FinancialIntermediary", new { id = item.FinancialIntermediaryID }, new AjaxOptions { HttpMethod = "GET", OnSuccess = "DeleteSuccessFI", Confirm = "are you sure to perform the deletion." },new { @class="classname" })  

您还需要为元素留出一些空间,以便显示背景图像:

.classname
        {
            background-image:url('../../Images/delete.png');
            display: inline-block;
            width: 20px; /* adjust as necessary */
            height: 10px;/* adjust as necessary */ 
        }