CSS文件未包含在剃须刀页面中
我是Razor页面概念的初学者。我开始在已经存在的项目中添加剃须刀页面。这是一个主页,我应该从头开始路由。我添加了CSS文件的链接,但不包括在内。我真的不知道为什么会发生这种情况。我确定路径是正确的,我将它们正确地定位在wwwroot中。几天前,我被困在那个。有什么想法,为什么会发生这种情况?
@model MyProject.Area
@{
Layout = null;
}
<!DOCTYPE html>
<html class="fullpagehight">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Raleway" />
<link href="~/lib/bootstrap/css/bootstrap.css" rel="stylesheet" />
</head>
<body class="fonttypeformat fullpagehight">
<div id="mainSection" class="bgimg w3-display-container w3-animate-opacity w3-text-white">
</div>
</body>
</html>
I am beginner in Razor pages concepts. I started to add a razor page in an already existing project. It's a home page and I should be routed to it on start. I added a link for css files but they are not included. I really don't have an idea why this happen. I am sure that the paths are right and I located them properly in the wwwroot. I am stuck on that few days ago. Any thoughts why might this happen?
@model MyProject.Area
@{
Layout = null;
}
<!DOCTYPE html>
<html class="fullpagehight">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Raleway" />
<link href="~/lib/bootstrap/css/bootstrap.css" rel="stylesheet" />
</head>
<body class="fonttypeformat fullpagehight">
<div id="mainSection" class="bgimg w3-display-container w3-animate-opacity w3-text-white">
</div>
</body>
</html>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要更改:
to:
没有 /在决赛中。希望我能帮助你。周末愉快。
问候
You need to change:
To:
Without / in the final. Hope I helped you. Have a wonderful weekend.
Regards
恐怕CSS的路径不正确。bootstrap.css文件默认情况下是
/lib/bootstrap/dist/dist/css
by默认情况正确。
I'm afraid maybe the path of css is not correct.The bootstrap.css file is in
/lib/bootstrap/dist/css
by default.So the css reference will be like:If the paths are correct.Try to make sure the project contains
app.UseStaticFiles();
in Startup.cs like this: