【发布时间】:2022-01-06 04:58:36
【问题描述】:
当我在 ASP.NET MVC 中的视图 html 上添加 css 类或更改引导类时,没有任何反应。
CSS 样式表
.icon {
margin-top: 8px;
border: 1px solid white;
border-radius: 100%;
}
.titleLibrary{
color: gray;
}
查看html
<a href="@Url.Action("Index","Home")">
<img src="@Url.Content("~/Icons/bookIcon.jpg")" width="50" class="icon" />
</a>
@Html.ActionLink("Library", "Index", "Home", new { area = "" }, new { @class = "titleLibrary" })
但是当我在 html 中使用样式时,一切都很好
<a href="@Url.Action("Index","Home")">
<img src="@Url.Content("~/Icons/bookIcon.jpg")" width="50" style=" border: 1px solid white; border-radius: 100%;" />
</a>
【问题讨论】:
-
内联样式总是比 CSS 文件中的样式具有更高的优先级。我认为您的 CSS 样式正在被覆盖。签入检查器窗口。
标签: c# html css asp.net-mvc view