你好,所以我在使用CSS时遇到了麻烦,我正在尝试移动它并更改背景颜色,但是似乎无法这样做,但是我可以更改其其他属性,例如居中对齐和权重< / p>
python文件:
arguments
html文件:
from flask import Flask, request, render_template
app = Flask(__name__)
@app.route('/homepage')
def homepage():
return render_template('homepage.html')
if __name__ == "__main__":
app.run(debug=True)
css页面:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="{{url_for('static',filename='homepage.css')}}">
<link href="https://fonts.googleapis.com/css?family=Raleway" rel="stylesheet">
<div class="navbar">
<h1 id=home>Home <h2>
<h1 id=about>About <h2>
<h1 id=location>Location <h2>
</div>
<h1 id=logo>4/12</h1>
</head>
<body>
<h1> welcome to the homepage</h1>
</body>
答案 0 :(得分:0)
将您的Nav放置在主体中,屏幕上显示的所有HTML代码都会进入主体。
接下来,在CSS的背景色上放置一个body标签。
body{
background-color: #333333;
}
#logo{
position: relative;
}
#home{
font-family: 'Raleway', sans-serif;
text-align: center;
}
#about{
font-family: 'Raleway', sans-serif;
}
#location{
font-family: 'Raleway', sans-serif;
}
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="{{url_for('static',filename='homepage.css')}}">
<link href="https://fonts.googleapis.com/css?family=Raleway" rel="stylesheet">
</head>
<body>
<h1> welcome to the homepage</h1>
<div class="navbar">
<h1 id=home>Home <h2>
<h1 id=about>About <h2>
<h1 id=location>Location <h2>
</div>
<h1 id=logo>4/12</h1>
</body>