【发布时间】:2018-12-23 11:44:28
【问题描述】:
我是 Bootstrap 4 的新手,但我已经阅读了 this 文档,它看起来很简单,但是我无法让这些列正常工作。我基本上只是想让所有的广告都显示在页面的左侧,col-8 占据了大部分,而在右侧我只是想设置一个带有创建帖子按钮的小框.它只会占用页面的col-4。
这是我的 HTML(注意:我使用的是 Django):
{% extends 'base.html' %}
This is the create a post page
{% block head %}
<!-- {% load static %}
<link rel="stylesheet" href="{% static 'accounts/login.css' %}" type="text/css"> -->
<title>Zaneroo - Latest Ads</title>
{% endblock %}
{% block body %}
<div class="container"><br>
<a href="{% url 'classifieds:create_post' %}">Post an Ad</a><br><br>
<section id="latest-ads">
<div class="ads">
<div class="row">
<div class="col-8">
Ads
</div>
</div>
</div>
<aside class="create-post">
<div class="row">
<div class="col-4">
Sidebar
</div>
</div>
</aside>
</section>
{% if messages %}
{% for message in messages %}
<br>{{ message }}<br>
{% endfor %}
{% endif %}
{% for post in posts %}
{% endfor %}
</div>
{% endblock %}
我知道引导程序正在被选中,因为导航栏仍然有效,字体不是默认的,链接也不是,但由于某种原因,列不是并排的。只是直接在彼此之上。
在我继承导航的 base.html 文件中,我在引导程序上使用此版本:
href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
Here是浏览器中HTML页面的图片。
非常感谢任何帮助。
【问题讨论】:
-
您的列嵌套在 div 中。可能是问题所在。
-
我删除了外部 div,不幸的是这并没有解决它。不过还是谢谢。
-
让我发布一个答案给你试试
标签: html twitter-bootstrap alignment