是ASP.net核心的新功能,如何使用cshtml向页面添加背景色?我正在使用自动生成的页面,但这是不变的白色,带有黑色的文本,似乎不喜欢使用内联。
。net核心应用程序中,shared / _layout.cshtml中有一个默认布局。每个视图都将使用该布局。在_layout.cshtml中,我们经常在<head></head>
中引用site.css。因此,如果要更改所有页面的背景色,可以在site.css中更改样式。也可以在_layout.cshtml中更改样式。
例如,我更改主体的背景色:
在site.css中:
body {
/* Margin bottom by footer height */
margin-bottom: 60px;
background-color:red;
}
在_layout.cshtml中:
<style>
body {
background-color:red;
}
</style>