您的位置:首页 > Web前端 > CSS

css实现倒三角包含文字标签

2018-02-11 16:46 453 查看
实现的最终效果



代码如下:<html>
<head>
<title>倒三角标签</title>
<style type="text/css">
.content {
background:#3c88c6;
position: relative;
width:200px;
height: 100px;
}
.word {
text-align: center;
margin: auto;
position: absolute;
display: inline-block;
width: 45px;
right: 0;
top: -40px;
color: #FFF;
transform-origin: bottom center;
transform: rotate(45deg);
font-size: 12px;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
.triangle-topright {
width: 0;
height: 0;
float: right;
font-size: xx-small;
border-top: 45px solid #00b570;
border-left: 45px solid transparent;
position: relative;
}
</style>
</head>
<body>
<div class = "content">
<div class="triangle-topright">
<div class="word">2积分</div>
</div>
</div>
</body>
</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: