国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發(fā) > CSS > 正文

CSS教程,CSS固定表頭的HTML表格

2024-07-11 08:40:07
字體:
供稿:網(wǎng)友

  用CSS實(shí)現(xiàn)的固定表頭的HTML表格。

曾經(jīng)在項(xiàng)目中實(shí)現(xiàn)過一個固定表頭的HTML表格,但使用了非常臃腫的代碼,因?yàn)閷?shí)際上是畫了三個一樣的表格。一個純粹用HTML和CSS實(shí)現(xiàn)的固定表頭的表格,其簡化代碼如下:

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head>
<style type="text/css">
<!–
body {
background: #FFF;
color: #000;
font: normal normal 12px Verdana, Geneva, Arial, Helvetica, sans-serif;
margin: 10px;
padding: 0
}
table, td, a {
color: #000;
font: normal normal 12px Verdana, Geneva, Arial, Helvetica, sans-serif
}
.td
{
nowrap:’true’;
}
div.tableContainer {
clear: both;
border: 1px solid #963;
height: 285px;
overflow: auto;
width: 100%;
}
/* WinIE 6.x needs to re-account for it’s scrollbar. Give it some padding */
/html div.tableContainer/* */ {
padding: 0 16px 0 0
}
/* clean up for allowing display Opera 5.x/6.x and MacIE 5.x */
html>body div.tableContainer {
height: auto;
padding: 0;
width: 740px
}
/* Reset overflow value to hidden for all non-IE browsers. */
/* Filter out Opera 5.x/6.x and MacIE 5.x */
head:first-child body div[class].tableContainer {
height: 285px;
overflow: hidden;
width: 756px
}
/* define width of table. IE browsers only */
/* if width is set to 100%, you can remove the width */
/* property from div.tableContainer and have the div scale */
div.tableContainer table {
float: left;
width: 100%
}
/* WinIE 6.x needs to re-account for padding. Give it a negative margin */
/html div.tableContainer table/* */ {
margin: 0 -16px 0 0
}
/* define width of table. Opera 5.x/6.x and MacIE 5.x */
html>body div.tableContainer table {
float: none;
margin: 0;
width: 740px
}
/* define width of table. Add 16px to width for scrollbar. */
/* All other non-IE browsers. Filter out Opera 5.x/6.x and MacIE 5.x */
head:first-child body div[class].tableContainer table {
width: 756px
}
/* set table header to a fixed position. WinIE 6.x only */
/* In WinIE 6.x, any element with a position property set to relative and is a child of */
/* an element that has an overflow property set, the relative value translates into fixed. */
/* Ex: parent element DIV with a class of tableContainer has an overflow property set to auto */
thead.fixedHeader tr {
position: relative;
/* expression is for WinIE 5.x only. Remove to validate and for pure CSS solution */
top: expression(document.getElementById("tableContainer").scrollTop)
/* set THEAD element to have block level attributes. All other non-IE browsers */

發(fā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 连江县| 眉山市| 阳西县| 石首市| 大连市| 合川市| 寿宁县| 迭部县| 景洪市| 托克逊县| 宜春市| 呼图壁县| 瑞金市| 泰和县| 明星| 佛教| 遂平县| 措勤县| 奉贤区| 河东区| 亳州市| 沈阳市| 永福县| 始兴县| 隆子县| 凤城市| 井冈山市| 湄潭县| 体育| 静宁县| 黄石市| 友谊县| 葫芦岛市| 定结县| 青海省| 玉林市| 临泽县| 绩溪县| 佛冈县| 吉木乃县| 沭阳县|