当前位置: 移动技术网 > IT编程>网页制作>CSS > 一些实用的Django+HTML设置

一些实用的Django+HTML设置

2019年12月04日  | 移动技术网IT编程  | 我要评论
一、关于引入变量 1.变量引入方法: {% block 块名称 %} <p>{{变量名}}<p> {% endblock %} 2.引入变量的值中标签是否转义: 不转义: {% autoescape off %} ...HTML代码... {% endautoescape %} 转义: {% aut ...

一、关于引入变量

1.变量引入方法:

{% block 块名称 %}

<p>{{变量名}}<p>

{% endblock %}

 

2.引入变量的值中标签是否转义:

不转义:

{% autoescape off %}

...html代码...

{% endautoescape %}

 

转义:

{% autoescape on %}

...html代码...

{% endautoescape %}

 

或者部分不转义部分转义:

{% autoescape off %}

...html代码...

{% autoescape on %}

...html代码...

{% endautoescape %}

 

 

二、表格数据水平+垂直居中

<td style="text-align:center;vertical-align:middle;margin:auto">表格数据</td>

 

 

三、表格列名跨行显示

使用 rowspan/colspan 属性,代表占用多少行/列,以下为代码和效果图

代码:

<table border="1" summary="this table gives some statistics about fruit
   flies: average height and weight, and percentage
     with red eyes (for both males and females).">
    <caption>
        <em>
            a test table with merged cells.
        </em>
    </caption>
    <tbody>
        <tr>
            <th rowspan="2">gender&nbsp;</th>
            <th colspan="1">max</th>
            <th colspan="1">min</th>
            <th rowspan="2">rate</th>
        </tr>
        <tr>
            <th>height</th>
            <th>weight</th>
        </tr>
        <tr>
            <td>male</td>
            <td>1.9</td>
            <td>100</td>
            <td>40%</td>
        </tr>
        <tr>
            <td>female</td>
            <td>1.7</td>
            <td>88</td>
            <td>43%</td>
        </tr>
    </tbody>
</table>
<p>

 

简化的效果图:

 

 

 

 

 

 

 

如您对本文有疑问或者有任何想说的,请点击进行留言回复,万千网友为您解惑!

相关文章:

验证码:
移动技术网