出于某种原因,标题未正确对齐并且导航栏太粗?我怎样才能让它显示正确对齐和更小的尺寸?
我确信它可以使用 Bootstrap 本身完成,无需额外的 css,对吧?
抱歉,我不能在这里直接发布图片,需要更高的声誉。
Screenshot of the navbar
{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="{% static 'css/bootstrap.css' %}">
<!-- This link is just added for support on StackOverflow. -->
<link href="http://157.97.56.42:8000/static/css/bootstrap.css" rel="stylesheet"/>
<style>
html, body {
margin-top: 65px;
}
</style>
{% block base.head %}
{% endblock %}
</head>
<body>
{% block base.header %}
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<span class="navbar-brand">Developity</span>
<ul class="nav navbar-nav">
<li><a href="/index" class="navbar-text">Home</a></li>
<li><a href="/projects" class="navbar-text">Projects</a></li>
</ul>
</nav>
{% endblock %}
{% block base.body %}
{% endblock %}
{% block base.footer %}
{% endblock %}
<script src="{% static 'js/jquery.js' %}"></script>
<script src="{% static 'js/bootstrap.js' %}"></script>
<!-- This link is just added for support on StackOverflow. -->
<script src="http://157.97.56.42:8000/static/js/jquery.js"></script>
<script src="http://157.97.56.42:8000/static/js/bootstrap.js"></script>
</body>
</html>
删除 navbar-text 类将删除链接的边距,使导航栏变小并对齐所有内容。
<nav class="navbar navbar-inverse" role="navigation">
<span class="navbar-brand">Developity</span>
<ul class="nav navbar-nav">
<li><a href="/index">Home</a></li>
<li><a href="/projects">Projects</a></li>
</ul>
</nav>
或者您可以将 navbar-text 添加到 navbar-brand 以使其具有与链接相同的边距。
<nav class="navbar navbar-inverse" role="navigation">
<span class="navbar-brand navbar-text">Developity</span>
<ul class="nav navbar-nav">
<li><a href="/index" class="navbar-text">Home</a></li>
<li><a href="/projects" class="navbar-text">Projects</a></li>
</ul>
</nav>
都显示在这里 http://codepen.io/anon/pen/RpvYba
我是一名优秀的程序员,十分优秀!