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

时间:2013-01-24 13:26:21

标签: 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

1 个答案:

答案 0 :(得分:7)

尝试:

<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/