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

Med*_*tor 2 html css html-table

我需要重构这个任务如何在表格单元格中添加三角形

我不需要背景div.

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

在此输入图像描述

Rya*_*ing 7

尝试:

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

如何将您的HTML更改为:

<td class="triangle">
<div>@Html.ImageContent("triangle_bonus.png", "")</div>
</td>
Run Code Online (Sandbox Code Playgroud)

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

<style>
td.triangle {position:relative}
td.triangle div {position:absolute; right:0; top:0;}
</style>
Run Code Online (Sandbox Code Playgroud)

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