【问题标题】:django_tables2 How to rezise table and also rezise bottom borderdjango_tables2 如何调整表格大小并调整底部边框
【发布时间】:2017-09-18 11:03:44
【问题描述】:

我已关注https://django-tables2.readthedocs.io/en/latest/pages/tutorial.html 创建表。我已经设法调整表格:

  • python 版本:3.5.2
  • django 版本:1.11.2

tables.py:

import django_tables2 as tables
from .models import Person

class PersonTable(tables.Table):
    class Meta:
        model = Person
        attrs = {'class': 'paleblue','width':'300%'}


people.html:

{% load render_table from django_tables2 %}
{% load static %}

<!doctype html>
<html>
    <head>
       <link rel="stylesheet" href="{% static 'django_tables2/them/paleblue/css/screen.css' %}" />
    </head>
    <body>
       {% render_table table %}

    </body>
</html>

我在文档中看不到任何更改底部边框大小的选项? 或者,我尝试更改 screen.css 以删除边框,但更改没有效果。即使我重命名 screen.css,当我单击查看页面源时,该链接仍处于活动状态。

【问题讨论】:

  • 这不是一个真正的 django-tables2 问题,而是如何使用 CSS 来设置表格样式和分页,但无论如何我都会尝试回答

标签: css django-tables2


【解决方案1】:

您应该调整表格周围的容器大小和分页,这对于default template has class table-container

您应该使用一些 CSS 来使该容器更宽,例如

<style>
    .table-container {
        width: 300%;
    }
</style>

您应该从表格定义中删除宽度属性,因为它会使表格的宽度是容器的 3 倍。

【讨论】:

  • 感谢您的回答!问题是链接 /static/django_tables2/themes/paleblue/css/screen.css 可以引用 screen.css 的两个位置。我编辑了错误的文件。
猜你喜欢
  • 2012-08-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-04-28
  • 1970-01-01
相关资源
最近更新 更多