0

When I try to use CSS to style the HTML elements while using flask, only some elements work. Only elements on the most out level in the html file seem to get styled.

from flask import Flask, redirect, url_for, render_template

app = Flask(__name__)

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

if __name__ == '__main__':
    app.run()
* {
    margin: 0px;
    padding: 0px;
}
h1 {
    background-color: orange;
}

#aaa {
    text-align: center;
}
<!DOCTYPE html>
<html lang="en">
<head>
    <title>Flask app</title>
    <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='styles/main.css') }}">
</head>
<body>
    <div class="main_div">
        <div id="aaa">
            ekfeokf
        </div>
    </div>
    <h1 class="re">efeefregoejif</h1>
</body>
</html>

Ive tried different things, using class, id, and just element "div" "h1" ect, but only the elements on the outest level (the h1 tag) are getting styles by the css file. The div inside (ive tried a h1 tag also) dont get styled...

0 Answers0