1.运行网页时导航条覆盖了页面文本
2.查询bootstrp资料,http://v3.bootcss.com/compone...,需要在body里面添加padding-bottom: 70px;但是对jinja2模版用的不熟悉,一直插错位置,一直没有效果,求帮忙指点一下。
下面是base.html,我添加{%block body%}后,出现了2个Hello test,如下图第一个还是被导航条内容盖住一点,第二个是我想要的效果
{% extends "bootstrap/base.html" %}
{% block title %}TEST% endblock %}
{% block head %}
{{ super() }}
<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}" type="image/x-icon">
<link rel="icon" href="{{ url_for('static', filename='favicon.ico') }}" type="image/x-icon">
{% endblock %}
{% block body %}
{{super()}}
<style>
padding-top: 70px
</style>
{% block navbar %}
<div class="navbar navbar-inverse navbar-fixed-top" style="background-color:#2fa4e7;border-color:#1995dc;border-radius:0px;>
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-2">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" style="color:#ffffff" href="{{ url_for('main.index') }}">涓叴</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a style="color:#ffffff" href="{{ url_for('main.sql') }}">鏁版嵁搴撶鐞/a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
{% if current_user.is_authenticated %}
<li><a style="color:#ffffff" href="{{ url_for('auth.logout') }}">娉ㄩ攢</a></li>
{% else %}
<li><a style="color:#ffffff" href="{{ url_for('auth.login') }}">鐧诲綍</a></li>
{% endif %}
</ul>
</div>
</div>
</div>
{% endblock navbar%}
{% block content %}
<div class="container">
{% for message in get_flashed_messages() %}
<div class="alert alert-warning">
<button type="button" class="close" data-dismiss="alert">×</button>
{{ message }}
</div>
{% endfor %}
{% block page_content %}{% endblock %}
</div>
{% endblock content%}
下面是index.html代码
{% extends "base.html" %}
{% block title %}涓叴{% endblock %}
{% block page_content %}
<div class="page-header">
<h1>Hello, {% if current_user.is_authenticated %}{{ current_user.username }}{% else %}Stranger{% endif %}!</h1>
</div>
{% endblock %}
~
~
你
base.html
文件的结尾少了一行代码导致原有的
body
没有被替换掉,就出现了两个