带有粘性标题的HTML表格 - 单元格宽度问题

时间:2015-10-12 10:49:59

标签: html css

我正在使用带有粘性标题的html表,在css中我使用

设置单元格宽度
th, td { width:110px }

当屏幕处于全宽时,这是有效的,但是当屏幕\框架小于100%或者窗口对于窗口太大时,表格标题和细节行不对齐。

这是文件的完整css

table tbody, table thead
{
display: block;
/*display: table-header-group;*/
table-layout: fixed;
}
table tbody  
{
overflow: auto;
height: 300px;
}
th, td { width:110px }
.colSelector tbody td:nth-child(1) {
width: 260px; 
}
.statusSelector tbody td:nth-child(1) {
width: 200px;
}
.statusSelector{ height: 150px;}

statusSelector和colSelector呈现正常,因为它们是由asp.net生成的单个表columsn,因此永远不会比页面或框架大。

如果有人可以帮我解决这个对齐问题,我将不胜感激,因为由于这个问题,粘贴标题似乎不易使用。

我创建了fiddle问题。

1 个答案:

答案 0 :(得分:1)

好吧,你可以补充一下:

table{
    min-width: 2200px;
}

110px

) 这是20列,每列private void transData(int sending_msg_int) throws IOException { String sending_msg = Integer.toString(sending_msg_int); SocketAddress socketAddress = new InetSocketAddress(ip, Data.Port); DatagramSocket ds = new DatagramSocket(); byte[] buffer = sending_msg.getBytes(); DatagramPacket dp = new DatagramPacket(buffer, buffer.length, socketAddress); ds.send(dp); ds.close(); } 。我更喜欢第一个。