MVC CSS 默认颜色
我创建了一个默认的 MVC 应用程序,并且想要更改主窗体的背景颜色。我进入 Site.css 并更改以下部分:
body
{
background-color:Black;
font-size: .75em;
font-family: Verdana, Helvetica, Sans-Serif;
margin: 0;
padding: 0;
color:White;
}
然后,当我在设计模式下查看 Site.Master 时,它会显示背景背景和白色文本。但是,当我随后运行该应用程序时,它会恢复为默认颜色。我可以通过简单地向正文添加样式标签来强制颜色变化:
<body style="background-color:Black">
效果很好。 CSS 文件似乎连接正确:
<head runat="server">
<title><asp:ContentPlaceHolder ID="TitleContent" runat="server" /></title>
<link href="../../Content/Site.css" rel="stylesheet" type="text/css" />
</head>
我做错了什么/丢失了什么?
I've created a default MVC app, and want to change the background colour of the main form. I go into the Site.css and change the following section:
body
{
background-color:Black;
font-size: .75em;
font-family: Verdana, Helvetica, Sans-Serif;
margin: 0;
padding: 0;
color:White;
}
Then, when I view the Site.Master in design mode, it shows with a back background and white text. However, when I subsequently run the app, it reverts to the default colours. I can force the colour change by simply adding a style tag to the body:
<body style="background-color:Black">
And that works fine. The CSS file seems to be wired up correctly:
<head runat="server">
<title><asp:ContentPlaceHolder ID="TitleContent" runat="server" /></title>
<link href="../../Content/Site.css" rel="stylesheet" type="text/css" />
</head>
What am I doing wrong / missing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
确保样式表的路径正确。
../../
仅当您相对于根目录有两个文件夹深度时才有效。Make sure the path to your stylesheet is correct.
../../
will only work when you're two folders deep relative to the root.