c# - 页面正在加载而不渲染 style.css
问题描述
这是我的项目目录
样式.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 ;
}
页面加载成功,但没有加载背景图片。请帮我。我阅读了不同的文章,并按照建议的解决方案执行了相同的步骤,但仍然存在问题。
解决方案
图像不在内容文件夹中。所以在你的css中,你应该返回一个文件夹:
background-image:url(../Images/image.jpg);
注意../
路径中之前的Images文件夹
推荐阅读
- python - 乌龟显示错误,以前可以正常工作
- java - 当我按下“新项目”时,如何在 Intellij Idea 的开始菜单中配置技术列表
- java - 是否可以自定义java流groupingBy的key?
- python - 将字典键和值转换为单独的列表?
- c - 在C中使用链表和横向树按顺序创建家谱
- spring - Spring Batch - AmqpWriter 和 AmqpReader 示例
- tensorflow - CUDA 版本崩溃
- javascript - React Native FlatList 水平滚动
- javascript - Nodejs,Binance API:此请求的时间戳在 recvWindow 之外
- sql - 2个表的SQL查询没有我想搜索2的键