Javascript 带有固定标题和水平和垂直卷轴的表格,不提供td或th的宽度

Javascript 带有固定标题和水平和垂直卷轴的表格,不提供td或th的宽度,javascript,jquery,html,css,Javascript,Jquery,Html,Css,我想创建一个具有固定标题的表,如果表中的内容增加,那么表应该得到水平或垂直滚动,而不给表列指定固定的宽度。我不想打断word以拉伸td或th高度(单元格应水平拉伸,向表格添加滚动条)。检查此选项 表属性名称 表属性名称 价值 价值 描述 描述 排列 左、中、右 HTML5中不支持。在HTML4.01中已弃用。根据周围文字指定表格的对齐方式 bgcolor rgb(x,x,x),#xxxxxx,颜色名称 HTML5中不支持。在HTML4.01中已弃用。指定表格的背景色 边境 1,"" 指定表格单

我想创建一个具有固定标题的表,如果表中的内容增加,那么表应该得到水平或垂直滚动,而不给表列指定固定的宽度。我不想打断word以拉伸td或th高度(单元格应水平拉伸,向表格添加滚动条)。

检查此选项


表属性名称
表属性名称
价值
价值
描述
描述
排列
左、中、右
HTML5中不支持。在HTML4.01中已弃用。根据周围文字指定表格的对齐方式
bgcolor
rgb(x,x,x),#xxxxxx,颜色名称
HTML5中不支持。在HTML4.01中已弃用。指定表格的背景色
边境
1,""
指定表格单元格是否应有边框
细胞填充
像素
HTML5中不支持。指定单元墙和单元内容之间的空间
细胞间距
像素
HTML5中不支持。指定单元格之间的间距
框架
空白、上方、下方、侧面、左侧、右侧、侧边、方框、边框
HTML5中不支持。指定外部边框的哪些部分应可见
规则
无、组、行、列、全部
HTML5中不支持。指定内部边框的哪些部分应可见
总结
文本
HTML5中不支持。指定表内容的摘要
宽度
像素,%
HTML5中不支持。指定表格的宽度
html,正文{
保证金:0;
填充:0;
身高:100%;
}
部分{
位置:相对位置;
边框:1px实心#000;
填充顶部:37px;
背景:#500;
}
第1节定位{
位置:绝对位置;
顶部:100px;
左:100px;
宽度:800px;
盒影:0 0 15px#333;
}
.集装箱{
溢出y:自动;
高度:200px;
}
桌子{
边界间距:0;
宽度:100%;
}
td+td{
左边框:1px实心#eee;
}
td,th{
边框底部:1px实心#eee;
背景:ddd;
颜色:#000;
填充:10px 25px;
}
th{
身高:0;
线高:0;
填充顶部:0;
填充底部:0;
颜色:透明;
边界:无;
空白:nowrap;
}
第四分区{
位置:绝对位置;
背景:透明;
颜色:#fff;
填充:9px 25px;
排名:0;
左边距:-25px;
线高:正常;
左边框:1px实心#800;
}
th:第一儿童组{
边界:无;
}

你一定试过什么,告诉我们你试过什么?请发布HTML和Javascipt…现在你想让人为你编写整个应用程序?请为此雇用一名编码员。
<section class="">
  <div class="container">
    <table>
      <thead>
        <tr class="header">
          <th>
            Table attribute name
            <div>Table attribute name</div>
          </th>
          <th>
            Value
            <div>Value</div>
          </th>
          <th>
            Description
            <div>Description</div>
          </th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td>align</td>
          <td>left, center, right</td>
          <td>Not supported in HTML5. Deprecated in HTML 4.01. Specifies the alignment of a table according to surrounding text</td>
        </tr>
        <tr>
          <td>bgcolor</td>
          <td>rgb(x,x,x), #xxxxxx, colorname</td>
          <td>Not supported in HTML5. Deprecated in HTML 4.01. Specifies the background color for a table</td>
        </tr>
        <tr>
          <td>border</td>
          <td>1,""</td>
          <td>Specifies whether the table cells should have borders or not</td>
        </tr>
        <tr>
          <td>cellpadding</td>
          <td>pixels</td>
          <td>Not supported in HTML5. Specifies the space between the cell wall and the cell content</td>
        </tr>
        <tr>
          <td>cellspacing</td>
          <td>pixels</td>
          <td>Not supported in HTML5. Specifies the space between cells</td>
        </tr>
        <tr>
          <td>frame</td>
          <td>void, above, below, hsides, lhs, rhs, vsides, box, border</td>
          <td>Not supported in HTML5. Specifies which parts of the outside borders that should be visible</td>
        </tr>
        <tr>
          <td>rules</td>
          <td>none, groups, rows, cols, all</td>
          <td>Not supported in HTML5. Specifies which parts of the inside borders that should be visible</td>
        </tr>
        <tr>
          <td>summary</td>
          <td>text</td>
          <td>Not supported in HTML5. Specifies a summary of the content of a table</td>
        </tr>
        <tr>
          <td>width</td>
          <td>pixels, %</td>
          <td>Not supported in HTML5. Specifies the width of a table</td>
        </tr>
      </tbody>
    </table>
  </div>
</section>

html, body{
  margin:0;
  padding:0;
  height:100%;
}
section {
  position: relative;
  border: 1px solid #000;
  padding-top: 37px;
  background: #500;
}
section.positioned {
  position: absolute;
  top:100px;
  left:100px;
  width:800px;
  box-shadow: 0 0 15px #333;
}
.container {
  overflow-y: auto;
  height: 200px;
}
table {
  border-spacing: 0;
  width:100%;
}
td + td {
  border-left:1px solid #eee;
}
td, th {
  border-bottom:1px solid #eee;
  background: #ddd;
  color: #000;
  padding: 10px 25px;
}
th {
  height: 0;
  line-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  color: transparent;
  border: none;
  white-space: nowrap;
}
th div{
  position: absolute;
  background: transparent;
  color: #fff;
  padding: 9px 25px;
  top: 0;
  margin-left: -25px;
  line-height: normal;
  border-left: 1px solid #800;
}
th:first-child div{
  border: none;
}