我是初学者,正在使用ASP.NET Core 2.2和EF Core开发购物车应用。
但是,我想更改主页中标题的文本颜色。
您可能会在 HomeController.cs 文件中的方法Index()下找到该文件,该文件用于在页面中显示标题:
public IActionResult Index()
{
var pies = _pieRepository.GetAllPies().OrderBy(p => p.Name);
var homeViewModel = new HomeViewModel()
{
Pies = pies.ToList(),
Title = "Welcome to Alexander's Shop!"
};
return View(homeViewModel);
}
如何将标题的字体颜色更改为白色?
谢谢。
答案 0 :(得分:0)
请尝试
@Html.EditorFor(x=>x.Model.Your TextName,"",new{@class="SomeClass"})
<style>
.SomeClass{
color:Red
}
</style>