这是我的元素目录
style.css
在内容下和
image.jpg
在图像下
Login.aspx page is default page.
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="LoginDemo.Login" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<link href="~/Content/style.css" rel="stylesheet" type="text/css" media="screen" runat="server" />
<title>LOGIN</title>
</head>
<body>
</body>
</html>
这是 CSS
*{
margin:0px;
padding:0px;
}
body{
background-image:url(Images/image.jpg);
background-size:cover;
background-attachment:fixed;
font-family:Times New Roman ;
}
页面加载成功,但未加载背景图片。请帮我。我阅读了不同的文章,并按照建议的解决方案执行了相同的步骤,但仍然存在问题。
最佳答案
图像不在内容文件夹中。所以在你的CSS中,你应该返回一个文件夹:
background-image:url(../Images/image.jpg);
注意路径中Images文件夹之前的../
关于c# - 页面正在加载但未渲染 style.css,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52647008/