使用CSS形狀和僞元素:
HTML
Foo |
CSS
* { margin: 0; padding: 0;}
td { border: 1px solid black; }
.comment:after {
content: "";
position: relative;
top: 0.5em;
border-left: 0.5em solid transparent;
border-top: 0.5em solid red;
}
修正包裝的更新答案:
td { border: 1px solid black; position: relative; }
.comment:after {
content: "";
position: absolute;
right: 0;
top: 0;
border-left: 0.5em solid transparent;
border-top: 0.5em solid red;
}