【发布时间】:2018-04-07 12:49:18
【问题描述】:
我正在开发 django 模板,并且正在将引导程序集成到项目的 html 模板中。即使内容没有填满页面,每个模板页面都是可滚动的。我希望所有网页都是不可折叠的,并将包含内容的 div 的默认高度设置为屏幕的 100%。
我很想消除页面的可滚动性并将固定高设置为打开的窗口的大小。
谁能帮帮我。这是我添加到引导列中的网页和自定义 css:
<div class="col content-max-height">
{% block content %}
{% endblock %}
</div>
{% extends "header.html" %}
{% block content %}
<h2 class="page-header">{{ group.group.name }}</h2>
<div class="scrollable-view">
{% for activity in activities %}
{% if activity.user == currentUser %}
{% if activity.general == 2 %}
<p>{{ activity.description }}</p>
{% endif %}
{% endif %}
{% if activity.user != currentUser %}
{% if activity.general == 1 %}
<p>{{ activity.description }}</p>
{% endif %}
{% endif %}
{% endfor %}
</div>
{% if currentUser == host.user %}
<a href="{% url 'add_expense' host.group.id %}">Add New Expense</a>
{% endif %}
{% endblock %}
我在 bootrap 类上方添加的 css 如下...
.content-max-height {
height: 200px !important;
}
我添加了这个以使 html 代码的第一部分中的 div 与屏幕一样大,并且不会更大以防止在整个网页中滚动。
.scrollable-view {
position: absolute !important;
width: 100% !important;
margin-top: 10px !important;
margin-bottom: 10px !important;
max-height: 1000px !important;
overflow-y: scroll !important;
}
如果存在溢出整体内容 div 高度的内容,我希望主要内容 div 中的特定 div 成为可滚动的 div。
这是整个屏幕的图像。您可以在侧面看到可滚动的轮子。我希望它消失并让中心的 div 可以滚动......
【问题讨论】:
标签: html css django django-templates