首页htmltdHTML Element Style - 如何在td表单元格的右上角添加div

HTML Element Style - 如何在td表单元格的右上角添加div

我们想知道如何在td表单元格的右上角添加div。

<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
td.triangle {
  position: relative;
  width: 100px;
  height: 100px;
  background: green;
}

td.triangle div {
  position: absolute;
  right: 0;
  top: 0;
  width: 10px;
  height: 10px;
  background: red;
}
</style>
</head>
<body>
  <table>
    <tr>
      <td class="triangle">
        <div></div>
      </td>
    </tr>
  </table>
</body>
</html>