Right triangle making style code:
<style>
.box{
width: 0;
height: 0;
border-top: 100px solid transparent; /*将上设置为透明,100是高度*/
border-right: 50px solid skyblue; /*将右设置为50px,50是宽度*/
border-bottom: 0;
border-left: 0;
}
can be converted to:
<style>
/*只保留右边边框有颜色*/
border-color: transparent red transparent transparent;
/*样式都是solid*/
border-style: solid;
/*上边框宽度要大,右边框宽度稍小,其余边框为0*/
border-width: 100px 50px 0 0;
</style>
Use a div to hold this right triangle:
<div class="box"></div>
To achieve this effect:
div part:
<div class="price">
<span class="miaosha">
¥1650
<i></i>
</span>
<span class="yuanjia">¥5650</span>
</div>
.price section:
.price{
width: 160px;
height: 26px;
line-height: 24px;
border: 1px solid red;
margin: 20px auto;
}
Left and triangle effect section:
.miaosha{
position: relative;
float: left;
width: 90px;
height: 100%;
background-color: red;
text-align: center;
color: #fff;
font-weight: 700;
margin-right: 5px;
}
.miaosha i{
position: absolute;
right: 0;
top: 0;
width: 0;
height: 0;
border-color: transparent #fff transparent transparent;
border-style: solid;
border-width: 26px 10px 0 0;
}
Right part:
.yuanjia{
font-size: 14px;
color: gray;
text-decoration: line-through;
}