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>
代码如下:<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>
相关文章推荐
- 用CSS实现ul标签中图片与文字底边对齐及自适应高度
- HTML中用div标签包含Marquee实现文字走马灯滚动效果
- text-decoration <del> <s> 实现横线从文字中间穿过的CSS效果属性和html标签
- 使用CSS制作文字环绕图片效果(文字内容包含<li>标签)
- 用css来实现自动截取文字
- CSS实例:用fieldset、legend实现文字写在边线上的效果
- 【IOS】扩展UIImageViewEx实现:手势移动,旋转,缩放(附带一个收缩的文字标签功能)
- 自动截取文字,css实现文字超出显示省略汇总
- css实现文字淡入淡出
- css实现文字两边的分割线
- 小技巧:用CSS如何实现单行图片与文字垂直居中
- css配合JavaScript实现tab标签切换效果
- CSS定义Hover实现文字变大的超级链接
- css实现页面文字不换行、自动换行、强制换行
- CSS实现背景透明,文字不透明,兼容所有浏览器
- Html+css实现纯文字和带图标的按钮
- css图片上悬浮文字(丝带效果)实现
- css实现圆角及三角
- CSS实现背景透明而背景上的文字不透明
- -webkit-line-clamp 实现限制文字显示多行省略(CSS 多行省略)