提问人:NoTimeLeft 提问时间:11/7/2023 最后编辑:NoTimeLeft 更新时间:11/8/2023 访问量:48
单个表单元格下的多个值 [关闭]
Multiple values under single Table cell [closed]
问:
我目前正在创建一个网站,但我不确定如何解决这个问题。我正在尝试使用 HTML 和 C# 为 DataTable 创建一个显示,它应该是可排序的,但我想做一些具体的事情。
我有一个包含 a 和 a 的对象列表,两者都是字符串。我想知道是否可以在单个单元格下插入多个值 (),还可以将鼠标悬停在名称上时显示。Name
Value
Name
Value
这是我在 Excel 中制作的一个示例,其中一行包含多个值。带下划线的 String 应可悬停,并显示为工具提示。Value
答:
1赞
Uday V
11/8/2023
#1
HTML: Both rowspan and tooltip added.
<body>
<table style="width:100%">
<tr>
<th>Name</th>
<td>Jill</td>
<td>Jill</td>
</tr>
<tr>
<th rowspan="3">Phone</th>
<td class="tooltip">555-1234 <span class="tooltiptext">Tooltip text</span></td>
<td>555-1234</td>
</tr>
<tr>
<td class="tooltip">555-1234 <span class="tooltiptext">Tooltip text</span></td>
<td></td>
</tr>
<tr>
<td class="tooltip">555-1234 <span class="tooltiptext">Tooltip text</span></td>
<td></td>
</tr>
<tr>
<th>Phone</th>
<td>555-1234</td>
<td>555-1234</td>
</tr>
</table>
<div class="tooltip">Hover over me
<span class="tooltiptext">Tooltip text</span>
</div>
<script src="script.js"></script>
</body>
CSS:
table, th, td {
border:1px solid black;
}
.tooltip .tooltiptext {
visibility: hidden;
width: 120px;
background-color: black;
color: #fff;
text-align: center;
border-radius: 6px;
padding: 5px 0;
/* Position the tooltip */
position: absolute;
z-index: 1;
}
.tooltip:hover .tooltiptext {
visibility: visible;
}
评论
0赞
NoTimeLeft
11/8/2023
这正是我所需要的。非常感谢!
0赞
Uday V
11/8/2023
当然,没问题。
评论