HTML自适应表格

<link type="text/css" rel="stylesheet" href="../../static/demo.css">
<!--<style>-->
<!--    @import url(demo.css);-->
<!--</style>-->
<input id="text" onkeydown="if(event.keyCode==13) {test()}" value="请输入工号,以逗号拆分(双击清空输入框)" style="width:161px;" ondblclick="this.value=''"/>
<input id="result" style="width:111px;height:41px" disabled="disabled" value={{ jobnumbers_result }}>
<form id="csrf" action="/xadmin/jobnumbers_search/" method="get">{% csrf_token %}
</form>
<script>
	function test(){
		var myform=$('#csrf'); //得到form对象
        var tmpInput=$("<input type='text' name='search_key'/>");
        tmpInput.attr("value", document.getElementById("text").value);
        myform.append(tmpInput);
        myform.submit();
	}

</script>
<div style="width:expression(window.screen.width - 300);height:600px;overflow-y:scroll;overflow-x:none;">
    <table border="1">
        {% for i in table_header %}
            <tr>
                {% for j in i %}
                    <th>{{j}}</th>
                {% endfor %}
            </tr>
        {% endfor %}
        {% for i in data %}
            <tr>
                {% for j in i %}
                    <th>{{j}}</th>
                {% endfor %}
            </tr>
        {% endfor %}

    </table>
</div>
table{
    width: 100%;
    border-collapse: collapse;
}

table caption{
    font-size: 2em;
    font-weight: bold;
    margin: 1em 0;
}

th,td{
    border: 1px solid #999;
    text-align: center;
    padding: 20px 0;
}

table thead tr{
    background-color: #008c8c;
    color: #fff;
}

table tbody tr:nth-child(odd){
    background-color: #eee;
}

table tbody tr:hover{
    background-color: #ccc;
}

table tbody tr td:first-child{
    color: #f40;
}

table tfoot tr td{
    text-align: right;
    padding-right: 20px;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值