.net - 在 asp.net 应用程序 View 中固定元素位置

标签 .net css asp.net-mvc html razor

我有一个 asp.net 应用程序,其中存在样式问题。在 View 中我有这个片段:

 @if (Model[0] > 5)
     {
         @Html.ActionLink("<<<<", "Projects_Management", new { inc = Model[0] - 5 }, new {@class="previous"})
     }

     @if (Model[0] < 5 * Model[2])
     {
     @Html.ActionLink(">>>>", "Projects_Management", new { inc = Model[0] + 5 }, new {@class="nextIcon"})
     }

CSS

.previous
{
     margin-left:10px;
     background: url('../images/previousIcon.png') no-repeat border-box right;
     display: block;
     width: 150px;
     height: 50px;
     text-indent: -9999px; /* hides the link text */
}
.nextIcon
{

        margin-left:80%;
     background: url('../images/nextIcon.png') no-repeat border-box right;
     display: inline-block;
     width: 150px;
     height: 50px;
     text-indent: -9999px; /* hides the link text */

}

但我有这个结果:

image

链接demo

这两个链接不在同一行。那么问题是什么:为什么他们不在同一条线上?我该如何修复我的代码?

最佳答案

.previous 类具有display: block 样式,将其替换为inline-block 就像.next

关于.net - 在 asp.net 应用程序 View 中固定元素位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19700944/

相关文章:

c# - 一个无法访问的类。 VS2010

jquery - IE7 图像在不应该加载时加载

html - 如何在 DIV 中对齐 UL

c# - 如何在我的 ActionFilter 中获取对 ModelState 属性的引用?

.net - 是否存在使用 DebuggerDisplayAttribute 呈现对象的方法

c# - .NET 未检测到任何 SQL Server 实例

.net - WCF session 超时

html - 页面内容上的页脚

c# - 为什么在 PartialView 上使用 EditorFor 在 MVC 4.5+ 中呈现局部 View

c# - 与多个实体的模型绑定(bind)