• 实现网页的表格标题固定


    <%@ page language="java" contentType="text/html; charset=utf-8"
        pageEncoding="utf-8"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-1.12.0.js"></script>
    <title>Insert title here</title>
    </head>
    <html>  
        <head>  
        <style type="text/css">  
            /*所有内容都在这个DIV内*/  
            div.all {  
                border: 3px solid #FF00FF;  
                 100%; /*这个宽度可根据实际需要改变*/  
                clear: right;  
            }  
              
            /*表头在这个DIV内*/  
            div.title {  
                 100%;  
            }  
            /*内容在这个DIV内*/  
            div.content {  
                 100%;  
                overflow: scroll;  /*总是显示滚动条*/  
                overflow-x: hidden; /*去掉横向滚动条*/  
                height: 400px;  
            }  
            div.title_left {  
                float: left;  
                margin-right: 17px;  
            }  
            div.content_left {  
                float: left;  
            }  
              
            .main_table {  
                 100%;  
                border: 1px solid #FF00FF;  
                border-collapse: collapse;  /*边线与旁边的合并*/    
                table-layout:fixed;  
            }  
            .main_table tr th {    
                border: 1px solid #FF00FF;    
                overflow: hidden;  /*超出长度的内容不显示*/    
                /*word-wrap: break-word;  内容将在边界内换行,这里显示省略号,所以不需要了*/    
                word-break: break-all;  /*字内断开*/    
                text-overflow: ellipsis;  /*当对象内文本溢出时显示省略标记(…),省略标记插入的位置是最后一个字符*/    
                white-space: nowrap;    
            }    
            /*单元格样式*/    
            .main_table tr td {    
                border: 1px solid #FF00FF;    
                overflow: hidden;    
                /*word-wrap: break-word;  内容将在边界内换行,这里显示省略号,所以不需要了*/    
                word-break: break-all;    
                text-overflow: ellipsis;    
                white-space: nowrap;
                text-align:center;    
            }    
        </style> 
        
        </head>  
        <body>  
            <div class="all">  
                <div class="title">  
                    <div class="title_left">  
                    <table class="main_table">  
                        <tr>  
                            <th style="30%">标题1</th><th style="20%">标题2</th><th style="40%">标题3</th><th style="10%">标题4</th>  
                        </tr>  
                    </table>  
                    </div>  
                </div>  
                <div class="content">  
                    <div class="content_left">  
                     
                    </div>  
                </div>  
            </div>  
        </body>  
    </html> 
    <script>
        var html="<table class='main_table'>";
           for(var i=0;i<40;i++){
          html+="<tr class="context-tr">";
          html+="<td style="30%">aaaa</td>";
          html+="<td style="20%">bbbb</td>";
          html+="<td style="40%">cccc</td>";
          html+="<td style="10%">dddd</td>";
          html+="</tr>";
           }
           html+="</table>"
           $(".content_left").append(html);
    </script>
  • 相关阅读:
    INode满的处理方法
    分布式转码集群思路
    FreeBSD Set a Default Route / Gateway
    ssh遇到port 22:No route to host问题的解决方法
    debian 开启SSH
    virsh 查看信息
    virsh console配置
    virsh console hangs at the escape character “^]”
    virt-install命令---详解
    kmv 学习笔记 工具
  • 原文地址:https://www.cnblogs.com/t0404/p/10290986.html
Copyright © 2020-2023  润新知