【发布时间】:2019-03-09 20:42:29
【问题描述】:
这是我的项目目录
style.css
在内容和
下图片.jpg
在图片下
Login.aspx 页面为默认页面。
<%@ 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 ;
}
页面加载成功,但没有加载背景图片。请帮我。我阅读了不同的文章,并按照建议的解决方案执行了相同的步骤,但仍然存在问题。
【问题讨论】:
-
您是否尝试过清除缓存或使用新的浏览器?
-
为什么是
runat="server"?通常该属性意味着一些服务器端执行/处理,并且在样式表中它看起来是不必要的(有问题,因为在 IIS 中没有为 css 扩展配置处理程序)。 -
@Sigma 是的,我清除缓存并使用新的浏览器。 bradbury9 我读了 1 篇文章,他们建议使用 runat=server