- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我这里有一个完全动态的表格,所有单元格都是从数据库的值动态生成的。问题是如何修复我的表格标题在滚动 x 和 y 轴时始终可见。我只是粘贴静态代码和我的 fiddle 。 http://jsfiddle.net/kannankds/8gMVJ/5/
<div id="container">
<table id="my_table">
<thead>
<th>head1</th>
<th>head1</th>
</thead>
<tbody>
<tr><td>data1</td>
<td>data2</td>
</tr>
</tbody>
</table>
</div>
最佳答案
你可以用一些 CSS 来做到这一点:
#table-wrapper {
position:relative;
}
#table-scroll {
height:150px;
overflow:auto;
margin-top:20px;
}
#table-wrapper table {
width:100%;
}
#table-wrapper table * {
background:yellow;
color:black;
}
#table-wrapper table thead th .text {
position:absolute;
top:-20px;
z-index:2;
height:20px;
width:35%;
border:1px solid red;
}
HTML:
<div id="table-wrapper">
<div id="table-scroll">
<table>
<thead>
<tr>
<th><span class="text">A</span></th>
<th><span class="text">B</span></th>
<th><span class="text">C</span></th>
</tr>
</thead>
<tbody>
<tr> <th>1, 0</th> <th>2, 0</th> <th>3, 0</th> </tr>
<tr> <th>1, 1</th> <th>2, 1</th> <th>3, 1</th> </tr>
<tr> <th>1, 2</th> <th>2, 2</th> <th>3, 2</th> </tr>
<tr> <th>1, 3</th> <th>2, 3</th> <th>3, 3</th> </tr>
</tbody>
</table>
</div>
</div>
你也可以使用
关于jquery - 动态表头修复问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24772427/
我有一个表格,其中有一个标题行和几行内容。 现在这些实际上是 2 个单独的表: 用于标题 正文内容(另一个 iframe 的一部分) 我希望列标题的宽度应与相应的正文内容相同。 如何确保宽度相似且外观
我有一个 iPhone 应用程序,它有一个 UITableView 和一个标题。这是相当微不足道的,没有任何问题。 Android 中是否有类似 ListView 的东西?我试着搜索它,但没有找到真正
制作方法 a b c d e 始终可打印在每一页上。 我的观
如下所示: 复制代码 代码如下: //定义编码 header( 'Content-Type:text/html;charset=utf-8 ');
我有一个非常长的 HTML 表格,我需要修复标题的滚动问题,我找到了很多插件和技巧来完成它,但没有一个对我有用。 我猜对我不起作用的原因是: 所有的解决方案都将表头从表中分离出来 他们为每一列使用固定
我有一个包含 60 行(固定)的 JTable。 每当事件发生时,该行内的单元格都会更新。 当 NFC Reader 在卡上写入数据时触发该事件。这种情况每 2 或 3 秒发生一次。 如果卡片写入正确
我需要打印一个带有重复表格的 pdf,具体取决于它在第一页中工作正常的记录数量,但在下一页表格标题更改边距,这是在 TCPDF 上显示我的表格的代码; $html= '
我的表头看起来像这样:- Info blahh
我正在使用 position:fixed 在用户滚动到顶部时在我的表格中 float 一些标题,ala 这个方法:http://css-tricks.com/persistent-headers/ 在
我正在使用这个脚本来 float 我的表格标题: http://cmcqueen1975.bitbucket.org/htmlFloatingTableHeader/tables.html 它对我的元
有没有办法从逗号分隔列表构建 HTML 表头? 我正在使用反射从一个类中获取属性名称。在此之前,我定义了要从该列表中排除的属性。 var toExclude = new HashSet {
我正在将自定义 UIView 的 XIB 文件加载为 View Controller 内的 uitableview 的标题 View 。 xib 文件的文件所有者是 View Controller 。
我有以下表结构: Current New/Requested RSD &nbs
前端部分(Vue 3 + Element Plus) 1. 修改 MPS002HList.vue(主生产计划列表) a. 添加查询表单 在模板中添加查询表单,包含产品料号、品名、规格和年月的输入
给出一个查询示例,例如 import uuid from google.cloud import bigquery def query_shakespeare(): client = bigq
给出一个查询示例,例如 import uuid from google.cloud import bigquery def query_shakespeare(): client = bigq
我的表格行可以上下 move ,但我的问题是数据表行取代了表格标题(第一行)。 我想要一个固定的第一行,这样当您单击向上箭头时,您就不会向上 move 该行来替换标题。 我尝试了一些条件逻辑来检查当前
在我的React项目中,需要自定义antd表头如下 我在下面添加了示例代码。 我需要在“金额”列的标题中包含金额总和 示例代码: https://codesandbox.io/embed/great-
A test table with merged cells Average Redeyes heightweight 1.90.00340% 1.70.00
我需要动态更改 Wicket 数据表的 CSS 类。有什么建议吗? 示例代码: public class TextColumn extends PropertyColumn private stati
我是一名优秀的程序员,十分优秀!