Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
108 views
in Technique[技术] by (71.8m points)

python - Flask - CSS turns HTML texts invisible on app

This is a weird problem which I have been getting when linking my html file to a css file. I am running the app using Flask on PyCharm.

**staticstyle.css**
body { 
    color: #fffa;
}
**templatesase.html**
...
<link rel="stlyesheet" href="{{ url_for('static', filename='style.css')}}">
...
<body>{% block content %} {% endblock %}</body>
**templateshome.html**
{% extends 'base.html' %}
...
{% block content %} example {% endblock %}

As a result, the string 'example' is printed on the website as I am able to highlight it but it appears to be "invisible" as I cannot see the texts without the manually selecting them (i.e., the screen is just blank perhaps due to text being white?) but I cannot prove the latter because even when I change the color in css to black or red it just remains invisible.

question from:https://stackoverflow.com/questions/66051884/flask-css-turns-html-texts-invisible-on-app

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Everything is working as it should be. #fffa will be treated probably as your browser as white(ish). And you are applying it to whole body. And if background color is set to white too (and probably it is by default) - then you can't see text.

If you want to see black text - you should set it to black or #000.

https://en.wikipedia.org/wiki/Web_colors#Basic_colors


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...