我使用下面的代码,我需要为编辑和删除设置条件,但是
问题是我希望细节接近删除,currenlty
向右移动,我尝试向左移动,也尝试使用 "margin-left: 20px"
并且它没有移动,
我应该怎么做?将详细信息移近删除位置?
@if (ViewBag.is)
{
<td>
@Html.ActionLink("Edit", "Edit", new { id = item.ID }) |
@Html.ActionLink("Delete", "Delete", new { id = item.ID }) |
</td>
}
<td style="left: 20px">@Html.ActionLink("Details", "Details", new { id = item.ID })</td>
最佳答案
它向右移动是因为您将它从左边移动了 20px
你应该使用 margin-right:20px
将它向左移动
使用
<td style="margin-right: 20px">
或
<td style="left: -20px">
即
<td style="margin-right: 20px">@Html.ActionLink("Details", "Details", new { id = item.ID })</td>
或
<td style="margin-left: -20px">@Html.ActionLink("Details", "Details", new { id = item.ID })</td>
编辑 来自@aashi 的评论
It will be better if you use a
div
rather than atd
then style that div to position:relative n give right/left:0
关于css - 向左移动按钮不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24508174/