【发布时间】:2014-08-11 05:34:11
【问题描述】:
我在 Visual Studio 2013 中有一个类似的操作链接
@Html.ActionLink(item.PlayerName, "Details", new { id = item.PlayerID })
然后我将其更改为添加一些颜色(使用引导程序 3)
<span class="text-primary">@Html.ActionLink(item.PlayerName, "Details", new { id = item.PlayerID })</span>
一切都很好,直到我决定改变颜色,但它没有工作它保持不变,我认为这很奇怪。我现在什至将代码改回了没有 span 标签的原始状态,它仍然是彩色的。这怎么可能。我已经清除了浏览器缓存,尝试了另一个浏览器,甚至重新启动了我的机器。
编辑:这是该页面的所有代码
@model IEnumerable<Ping_Pong.Models.Player>
@{
ViewBag.Title = "Index";
}
<p class="spacetop">
@Html.ActionLink("Create New Player", "Create", null, new { @class = "btn btn-primary" })
</p>
<table class="table">
<tr>
<th>
@Html.DisplayNameFor(model => model.PlayerName)
</th>
<th>
@Html.DisplayNameFor(model => model.PlayerScore)
</th>
<th>
@Html.DisplayNameFor(model => model.PlayerDiv)
</th>
<th>
@Html.DisplayNameFor(model => model.PlayerActive)
</th>
<th></th>
</tr>
@foreach (var item in Model) {
<tr>
<td>
@Html.ActionLink(item.PlayerName, "Details", new { id = item.PlayerID })
</td>
<td>
<span class="label label-success">@Html.DisplayFor(modelItem => item.PlayerScore)</span>
</td>
<td>
<span class="label label-success">@Html.DisplayFor(modelItem => item.PlayerDiv)</span>
</td>
<td>
@Html.DisplayFor(modelItem => item.PlayerActive)
</td>
<td>
@Html.ActionLink("Edit", "Edit", new { id = item.PlayerID }, new { @class = "btn btn-warning btn-sm" })
@Html.ActionLink("Delete", "Delete", new { id = item.PlayerID }, new { @class = "btn btn-danger btn-sm" })
</td>
</tr>
}
</table>
【问题讨论】:
-
你能展示为你的 span 和 anchor 元素生成的 HTML 吗?另外,在引导 CSS 文件中,你能显示所有提到
text-primary的样式吗?这将帮助那些试图找出问题所在的人。 -
这就是我的意思,现在没有 span 标签了,我已经删除了它,它仍然在发生,因为 css 文件它只是引导 css 未修改。但是这里来自源页面 Your Name
-
检查生成页面上的元素并检查应用的 CSS 样式。
-
要找出颜色的来源,请使用浏览器开发人员工具查看
<a>元素的样式。如果您检查一个元素,开发工具可以告诉您该元素的样式在 css 文件中的来源。 -
现在找到原因了。刚刚发布了答案。谢谢大家
标签: c# html asp.net-mvc twitter-bootstrap razor