18910140161

无论我做什么,CSS都不会加载到Flask中,即使直接加载到HTML文件中-堆栈溢出

顺晟科技

2022-10-18 12:36:57

155

我一直有这个奇怪的CSS错误的事情,即使烧瓶说文件正在加载,它没有显示出来。我尝试过不同的浏览器,更改文件位置,重写文件链接,甚至将CSS直接放入HTML文件中。没什么.

CSS文件:

<代码>.IMG_一半_和_一半_右{高度:850px;宽度:50%;动画:Fadeout Ease 5S Forwards;动画延迟:1s;大小:相对;位置:相对;浮子:右;}.IMG_一半_和_一半_左{高度:850px;宽度:50%;动画:Fadeout Ease 5S Forwards;浮动:左;}.thickboi{边框:实心;边框宽度:2.5px;颜色:蓝色;边框颜色:蓝色;填充:1px;边距:1px;浮动:左;}.droptext{动画:DropDownText Ease 5S向前;动画延迟:7s;字体大小:20px;不透明度:0;位置:相对;边距:0px;填充:0px;浮动:中心;文本对齐:居中;.pfpboi{宽度:100px;高度:100px;背景色:青绿色;边界半径:100%;边距:10px;填充:1px;位置:相对;浮动:左;动画:对角线_移动缓动3s向前;动画延迟:6s;}@关键帧淡出{0% {不透明度:1;}100% {不透明度:0;}}@关键帧淡入{0%{不透明度:0;}1%{不透明度:1;}}@keyframes对角线_移动{0%{右:0px;顶部:0px;}100%{右:中心;顶部:中心;} }@keyframes dropdowntext{0%{不透明度:0;顶部:-1000px;}100%{不透明度:1;顶部:-600px;} }

烧瓶应用程序:

.img_half_and_half_right{
        height: 850px;
        width: 50%;
        animation: fadeOut ease 5s forwards;
        animation-delay: 1s;
        size: relative;
        position: relative;
        float: right;
}
.img_half_and_half_left{
        height: 850px;
        width: 50%;
        animation: fadeOut ease 5s forwards;
        float: left;

}
.thickboi{
        border: solid;
        border-width: 2.5px;
        color: blue;
        border-color: blue;
        padding: 1px;
        margin: 1px;
        float: left;
}

.droptext{
        animation: Dropdowntext ease 5s forwards;
        animation-delay: 7s;
        font-size: 20px;
        opacity:0;
        position: relative;
        margin: 0px;
        padding: 0px;
        float: center;
        text-align: center;


.pfpboi{
        width: 100px;
        height: 100px;
        background-color: turquoise;
        border-radius: 100%;
        margin:10px;
        padding: 1px;
        position: relative;
        float: left;
        animation: Diaganle_movement ease 3s forwards;
        animation-delay: 6s;
}

@keyframes fadeOut {
   0% {
        opacity:1;
        }
  100% {
        opacity:0;
        }
}

@keyframes fadeIn{
        0%{
                opacity:0;
        }
        1%{
                opacity:1;
                }
}
 @keyframes Diaganle_movement{
        0%{
                right: 0px;
                top: 0px;
        }
        100%{
                right: center;
                top: center;
        }
 }

 @keyframes Dropdowntext{
        0%{
                opacity:0;
                top: -1000px;
        }
        100%{
                opacity:1;
                top: -600px;
        }
 }

HTML文件:

from flask import Flask, render_template, url_for, session, flash, request
#from waitress_serve import serves

app = Flask(__name__)

@app.route('/', methods = ['GET', 'POST'])
def main():
    return render_template('index.html')

@app.route('/resource')
def resources():
    return render_template('resources.html')

@app.route('/login')
def login():
    return render_template('login.html')


if __name__ == '__main__':
    app.run(debug=True, host='192.168.1.56', port='80')
#    serve(app, host='192.168.1.56', port=80)
如果我做错了什么,

请让我知道。


顺晟科技:

由于CSS文件已经在静态文件夹中,因此请进行此更改。

{% extends "base.html" %}
{% block content %}
        <img class='img_half_and_half_right' src="{{ url_for('static', filename='img/code.jpeg') }}">
        <img class='img_half_and_half_left' src="{{ url_for('static', filename='img/computerpart.jpg')}}">
        <p class='droptext'>Astoshan Stuerm</p> '
        <center> <div class='pfpboi'></div> </center>
{% endblock %}
刷新页面

时,请使用Ctrl+Shift+R

  • TAG:
相关文章
我们已经准备好了,你呢?
2024我们与您携手共赢,为您的企业形象保驾护航