JSFiddle - React, Tailwind, and code Playground
HTML
<div class="triangle">
向上的三角
</div>
<br />
<div class="rightTriangle">
向右的三角
</div>
<br />
<div>例子:</div>
<div class="issue">Issue<em>15</em></div>
<a href="http://www.camnpr.com/">更多访问...</a>
CSS
.triangle, .rightTriangle{background-color:#000;width:50px;height:100px;color:#fff;}
.triangle:after{content:'';display:block; border:25px solid transparent; border-bottom:21px solid #fff;border-top:none}
.rightTriangle:after{content:'';display:block;border-top: 5px solid transparent;
border-bottom: 5px solid transparent; border-left: 15px solid #fff;}
/*case*/
.issue {
position: absolute;
top: 0;
right: 90px;
width: 48px;
height: 58px;
font-family: Georgia;
background: #649F0C;
text-align: center;
font-size: 15px;
line-height: 1.2;
padding-top:6px;
}
.issue:after {
content: '';
display: block;
position: absolute;
width: 0px;
height: 0px;
bottom: 0;
left: 0;
border: 27px solid transparent;
border-bottom: 15px solid #fff; /*此颜色根据页面背景色一直。不能为透明色transparent*/
border-top: none;
z-index: 1;
}
.issue em {
display: block;
font-style: normal;
font-size: 18px;
}