1. 程式人生 > >jsp table實現表頭固定,並且表頭和內容對齊

jsp table實現表頭固定,並且表頭和內容對齊

overflow-y:scroll 實現滾動條,<colgroup>標籤使表頭和內容對齊,其中表頭設定的寬度之和為1600px,是頁面寬度1168px的1.37倍,另外預留17px作為滾動條,所以第二個div寬度為138.4555%。程式碼如下

<div>

<div class="table-head" style="width:137%">
<table id="contentTable"  class="table table-striped table-bordered table-condensed table-hover table-fixed-header" style="margin-bottom:0px;width:137%">
<colgroup>
<col style="width: 120px;" />
<col style="width: 100px;" />
<col style="width: 80px;" />
<col style="width: 80px;" />
<col style="width: 80px;" />
<col style="width: 120px;" />
<col style="width: 80px;" />
<col style="width: 80px;" />
<col style="width: 80px;" />
<col style="width: 80px;" />
<col style="width: 80px;" />
<col style="width: 80px;" />
<col style="width: 80px;" />
<col style="width: 80px;" />
<col style="width: 120px;" />
<col style="width: 80px;" />
<col style="width: 80px;" />
<col style="width: 80px;" />
<col />
</colgroup>
<thead  class="header" >
<tr>
<th>航線</th>
<th>航班號</th>
<th>起飛時刻</th>
<th>機型</th>
<th>標準票價</th>
<th>單班飛行小時</th>
<th>班次</th>
<th>提供座位數</th>
<th>合計旅客數</th>
<th>合計收入</th>
<th>班收入</th>
<th>客座率</th>
<th>票價水平</th>
<th>人均票價</th>
<th>標準票價客座率</th>
<th>座公里收入</th>
<th>客公里收入</th>
<th>小時收入</th>
</tr>
</thead>
</table>
</div>
<div style="overflow-y:scroll; width:138.4555%;height:100%;">
        <table  style="width:137%;" class="table table-striped table-bordered table-condensed table-hover ">
<colgroup>
<col style="width: 120px;" />
<col style="width: 100px;" />
<col style="width: 80px;" />
<col style="width: 80px;" />
<col style="width: 80px;" />
<col style="width: 120px;" />
<col style="width: 80px;" />
<col style="width: 80px;" />
<col style="width: 80px;" />
<col style="width: 80px;" />
<col style="width: 80px;" />
<col style="width: 80px;" />
<col style="width: 80px;" />
<col style="width: 80px;" />
<col style="width: 120px;" />
<col style="width: 80px;" />
<col style="width: 80px;" />
<col style="width: 80px;" />
<col />
</colgroup>
<tbody id="container">
</tbody>
</table>
</div>
</div>

相關推薦

jsp table實現表頭固定並且表頭內容

overflow-y:scroll 實現滾動條,<colgroup>標籤使表頭和內容對齊,其中表頭設定的寬度之和為1600px,是頁面寬度1168px的1.37倍,另外預留17px作為滾動條,所以第二個div寬度為138.4555%。程式碼如下 <div

bootstrap-table 表頭內容問題

使用bootstrap-table 只需要提供一個json 介面就可以方便的展示一個表格資料。 最近在使用的時候遇到一個問題,表頭和內容不能對齊,對於越來越強迫症的我,怎麼能忍。 data-height=”100%” 去掉,直接變為了齊刷刷!爽

table中head表頭固定body滾動

<div style="width: 800px;"> <div class="table-head"> <table> <colgroup> <col st

關於jsp頁面表格表頭固定隨著下拉條表頭移動

在專案中碰見jsp頁面遍歷資料過多,下拉後看不見表頭,如果用easyUi就不存在固定表頭問題了。 如果是單純的table,遍歷,那麼我們可以引用bootstrap中的滾動監聽來控制。 在頁面引入  <link rel="stylesheet" href="https

HTML table 表格 thead 表頭固定tbody 滾動

第一種方式實現 使用 css 樣式設定thead 和 tbody 【 推薦方式 】 #tableid>thead>tr{ display: table;

表格鎖定表頭並且表頭寬度跟內容寬度

因為業務需要,需要將列表的表頭鎖死所以在各種百度之後終於找到了解決方案。 就是將表頭跟內容分離開,用一個大的DIV包住 然後通過CSS將內容對齊,具體看程式碼 1:html <div class="sti-tbl-container" >

表頭固定內容可以上下左右滾動左右滾動表頭聯動

準備工作                 xxx.html css:   reset.min.css         style.css js:      index.js                  jquery.min.js 一、xxx.html(內容部分多填

前端-表頭固定內容滾動

原理: 利用兩個table,一個div包裝一個table表頭,一個div包裝一個table的body <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <

簡單實現頂部固定中部自適應布局

col position fix enter span text auto pos otto 最近在重構web導航的時候就發現一個問題,如何實現頂部固定,中部自適應的布局。 很多人會認為這很簡單啊,頂部使用position: fixed;就可

hexo的next主題部落格中加入分類頁面的js實現多級目錄並且能夠點選展開隱藏下級目錄~(不知道算不算深度優化~~~)

多級標題 在自己的xxxx.md檔案中做如下修改: categories: - 搗蛋鬼 - mac 新建catogery_js.js(名字無所謂) 加入自己的js 我這裡是下面這樣的 function category_js () { $("&

使用Ajax方法實現分類註冊並且通過attr()改變input標籤name的屬性

 form表單中姓名的id必須要設定,下面會需要用attr()改變name的值,以便傳到後臺對應不同的name欄位 <form method="post"id="myform" name="myform"> 姓名: <input type="tex

在Untiy中實現掃雷遊戲並且打包Apk

前言:《掃雷》是一款大眾類的益智小遊戲,於1992年發行。遊戲目標是在最短的時間內根據點選格子出現的數字找出所有非雷格子,同時避免踩雷,踩到一個雷即全盤皆輸。 在實現掃雷的主要邏輯中,主要的難點: (1)如何檢測以一個物件為中心的八個方向上面的雷的個數。 (2)檢測如果

display:flex實現一端固定另一端寬度自適應

1,text-align屬性具有繼承性,外部div內嵌div時,外部text-align失效,而內部div繼承了外部的text-align;則內部div只好使用margin:auto來實現水平居中; 2,當某個元素(比如div)使用inline-block的時候,如果內部含有元素(比如含有p,h

表格table的thead固定tbody顯示滾動條滾動條不佔位

在書寫專案的時候,當給tbody加滾動條時由於滾動條會佔位,總是出現表格邊框不對齊有錯位的效果呢,如下圖 <table class="table_cell">

linux shell ssh實現自動登入並且執行一些操作並返回到當前主機

#!/usr/bin/expect -f #-------------------------------------------------- about us # product: monitorone # Author:matthew # Last Modified:

table裡表格固定大小並且內容自動換行

給table 加上 table-layout:fixed;word-break:break-all;word-wrap:break-word;border-collapse:collapse;margin:0;padding:0; css屬性,並且td和table的width都要指定,就能解決ie7,8,f

Angularjs 前端資料用orderBy排序表頭表頭處理表頭不預設排序

  orderBy這個功能其實是內建的過濾器,他可以在html和js程式碼中使用     html:{{ orderBy_expression | orderBy : expression : reverse}}     js    :$filter('orderBy

Android學習------運用 Filter 實現關鍵字搜尋並且高亮顯示關鍵字

新鮮出爐的demo   程式碼有點亂 講究著看吧。。。頭暈。。 先看 想要實現的功能效果 : 第一步  資料初始化   第二步監聽 輸入框裡面的 關鍵字   進行過濾   運用Filter 過濾 第三步 在自己的adapter類裡面實現自己的  Filte

輸入大於5位的正整數實現輸出它的位數並且正向逆向輸出這個整數

int main() {char c;int count = 0;char num_string[20];int i = 0;while ((c=getchar())!='\n'){count++;num_string[i] = c;i++;}printf("%d\n",count);for (int j =

實現一個類把冒泡插入封裝到兩個函式中去(宣告兩個函式一個是冒泡一個是插入)且進行呼叫除錯

實現一個類,把冒泡和插入封裝到兩個函式中去(宣告兩個函式,一個是冒泡,一個是插入),且進行呼叫和除錯 import java.util.Arrays; /* * 實現一個類,把冒泡和插入封裝到兩個函式中去(宣告兩個函式,一個是冒泡,一個是插入),且進行呼叫和除錯 */ public class E