我是 Flask 和 Bootstrap 的新手,并尝试将它们一起使用,但是当呈现 html 时,bootstrap 的样式没有得到应用,它很简单。具体来说,我从 Bootstrap 的组件页面获得的“<div class="nav nav-tabs nav-justified">
”没有得到应用。有人可以告诉我为什么吗?我现在正在本地开发。在此之前我用于样式设置的 CSS 文件运行良好。
提前致谢。
我的代码:
<!doctype html>
<title>My Page</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<div class=page>
<h1>My Page</h1>
<div class="nav nav-tabs nav-justified">
<a href="{{ url_for('main_page') }} ">home</a>
{% if not session.logged_in %}
<a href="{{ url_for('login') }}">log in</a>
{% else %}
<a href="{{ url_for('logout') }}">log out</a>
<a href="{{ url_for('reminders') }}">reminders</a>
{% endif %}
<a href="{{ url_for('about') }}">about</a>
</div>
{% for message in get_flashed_messages() %}
<div class=flash>{{ message }}</div>
{% endfor %}
{% block body %}{% endblock %}
</div>
最佳答案
您的 head 标签丢失了。你需要
<head>styles go here</head>
在您的 <!doctype html>
下方的右上角标签。
关于html - 为什么我的 bootstrap 样式没有得到应用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32903663/