我构建了一个简单的Flask应用,并且尝试通过url设置背景图片。我遵循了来自众多站点的示例,但是图像仍未呈现。我还有一个单独的html文件,称为notes,我正尝试链接到同样无法正常工作的初始HTML页面。
<!DOCTYPE html>
<html lang="en" dir="ltr">
<body>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="C:\Users\Desktop\Heart_Disease_APP\templates\HD.css">
<h1>Heart Disease Prediction</h1>
<body>
HD.css:
body{
background-image: url("https://3l4jojspj4-flywheel.netdna-ssl.com/wp-content/uploads/iStock-
921951792.jpg")
background-repeat: no-repeat;
height:160px;
padding-left:280px;
padding-top:50px;
width:470px;
color: #eaeaea;
border-bottom:1px solid #eaeaea;
}
br{
text-align: right;
}
<ul>
<form method="GET">
<li><a href="Notes.html">Click Here for Notes</a>
<br>
</ul>
答案 0 :(得分:0)
css中有一些错误,即background-image
属性中。关闭;
后,先关闭标签 background-image
。第二个url
带有空格,因此路径引发错误。将代码更正为此:
body{
background-image: url("https://3l4jojspj4-flywheel.netdna-ssl.com/wp-content/uploads/iStock-921951792.jpg");
background-repeat: no-repeat;
height:160px;
padding-left:280px;
padding-top:50px;
width:470px;
color: #eaeaea;
border-bottom:1px solid #eaeaea;
}