Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/solr/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 我需要一个固定的表格标题与滚动体。我什么都试过了,但似乎不管用_Javascript_Jquery_Html_Css - Fatal编程技术网

Javascript 我需要一个固定的表格标题与滚动体。我什么都试过了,但似乎不管用

Javascript 我需要一个固定的表格标题与滚动体。我什么都试过了,但似乎不管用,javascript,jquery,html,css,Javascript,Jquery,Html,Css,如果将ad和tbody的显示属性设置为inline block,则会出现滚动。可能不完全是你所需要的,但你必须仔细考虑一下 此外,还必须将表包装在容器div中,这样元素就不会散开 h1, h2, h6 { font-family: Helvetica; text-align: center; } header { background-color: #FFFFFF; position: fixed; width: 100%; top: 0px; border-bottom: solid; h

如果将ad和tbody的显示属性设置为inline block,则会出现滚动。可能不完全是你所需要的,但你必须仔细考虑一下

此外,还必须将表包装在容器div中,这样元素就不会散开

h1, h2, h6 { 
font-family: Helvetica;
text-align: center;
}

header {
background-color: #FFFFFF;
position: fixed;
width: 100%;
top: 0px;
border-bottom: solid;
height: 99px;
}

tr, td {
padding: 5px;
}

table {
margin-top: 5px;
}

/* Sortable tables */
table.sortable thead {
    background-color: #eee;
    color: #E5855F;
    cursor: default;
}


tr:nth-child(even) {
background-color: #FFC792;
}

thead {
font-family: Helvetica;
text-align: left;
}

tbody {
overflow: auto;
}

a:link {
color: black; 
}

footer {
background-color: #FFFFFF;
position: fixed;
width: 100%;
top: auto;
bottom: 0px;
border-top: solid;
}

这件事我已经坚持了大约一个星期了。每次我尝试使用javascript时,它似乎无法与我的代码一起工作。我真正需要的是一个固定的表格标题,但似乎无法解决它。我已经进入了谷歌前50名的搜索,但没有结果。我想我的代码一定有一些基本的问题。你有没有尝试过最好的插件?但它似乎不起作用不是一个真正的问题。通常问题会问一些问题。他们有一个问号。看见像这样?我想我的问题是如何使表格有固定的标题和可滚动的正文。我想这很清楚。
h1, h2, h6 { 
font-family: Helvetica;
text-align: center;
}

header {
background-color: #FFFFFF;
position: fixed;
width: 100%;
top: 0px;
border-bottom: solid;
height: 99px;
}

tr, td {
padding: 5px;
}

table {
margin-top: 5px;
}

/* Sortable tables */
table.sortable thead {
    background-color: #eee;
    color: #E5855F;
    cursor: default;
}


tr:nth-child(even) {
background-color: #FFC792;
}

thead {
font-family: Helvetica;
text-align: left;
}

tbody {
overflow: auto;
}

a:link {
color: black; 
}

footer {
background-color: #FFFFFF;
position: fixed;
width: 100%;
top: auto;
bottom: 0px;
border-top: solid;
}
thead {

  width: 290px;
  display: inline-block;
}

tbody {

  width: 290px;
display: inline-block;
height: 70px;
overflow-y: scroll;
}

table {
margin-top: 5px;

}

tbody {
  overflow-y: scroll;
}


#table-cont {


  width: 290px;
}