html - 如何在td的右上角添加div?

标签 html css html-table

我需要重构这个任务 How to add triangle in table cell

我不需要背景 div。

    <td>
     <div style="position: relative;right: 0;top:0;">@Html.ImageContent("triangle_bonus.png", "")</div>
//@Html.DropDownListExtention
    </td>

enter image description here

最佳答案

尝试:

<td style="position: relative;">
<div style="position: absolute;right: 0;top:0;">@Html.ImageContent("triangle_bonus.png", "")</div>
</td>

如何将您的 html 更改为:

<td class="triangle">
<div>@Html.ImageContent("triangle_bonus.png", "")</div>
</td>

并将此添加到您的头部 html:

<style>
td.triangle {position:relative}
td.triangle div {position:absolute; right:0; top:0;}
</style>

看这个例子: http://jsfiddle.net/Juvcx/

关于html - 如何在td的右上角添加div?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14502436/

相关文章:

html - CSS 适用于 HTML 但不适用于 Razor 语法

jquery - 所有内容都显示在一行中,而不是它们应该在的行中

html - 表格和 td 宽度问题

php - 更新多个字段时更新未推送到数据库

javascript - 与服务器通信的 html 小部件

html - 特定菜单项的 CSS 隐藏下拉菜单

html - 表格单元格的左边框在 Firefox 和 IE 中不通过

css - 如何在 CSS 网格中并排设置列表项

javascript - 在 onClick() 方法中切换元素的可见性

JavaScript 帮助、表格和单选按钮