Skip to content

Instantly share code, notes, and snippets.

@leavlzi
Last active October 24, 2018 01:56
Show Gist options
  • Save leavlzi/7228590 to your computer and use it in GitHub Desktop.
Save leavlzi/7228590 to your computer and use it in GitHub Desktop.
CSS实现三角形缺口
<!DOCTYPE html>
<html>
<head>
<title>CSS实现三角形缺口</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<style type="text/css">
html, body {
height: 100%;
}
.title-wrap{
position: relative;
display: block;
width: 100px;
height: 100px;
background: #ff0000;
}
.wrap{
height:100%;
}
.title-wrap b{
position: absolute;
top: 45px;
right: 0px;
line-height: 0;
font-size: 0;
border-right: 7px solid #ffffff;
border-top: 7px dashed transparent;
border-bottom: 7px dashed transparent;
}
</style>
<div id="wrap">
<div class="test">
<span class="title-wrap">
优惠
<b></b>
</span>
</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment