css三角形箭头代码实例

快乐打工仔 分类:实例代码

本章节分享一段代码实例,它实现了三角形箭头效果。

代码实例如下:

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="author" content="http://www.pipipi.net/" />
<title>前端教程网</title>
<style type="text/css">
html, body {
  padding: 0px;
  margin: 0px;
}
div {
  margin: 0px auto;
}
.one {
  width: 0px;
  height: 0px;
  border-top: 30px solid transparent;
  border-right: 30px solid transparent;
  border-bottom: 30px solid red;
  border-left: 30px solid transparent;
}
.true {
  margin-top: -60px;
  width: 0px;
  height: 0px;
  border-top: 50px solid transparent;
  border-right: 50px solid transparent;
  border-bottom: 50px solid red;
  border-left: 50px solid transparent;
}
.three {
  width: 30px;
  height: 60px;
  background: red;
}
</style>
</head>
<body>
  <div class="zong">
    <div class="one"></div>
    <div class="true"></div>
    <div class="three"></div>
  </div>
</body>
</html>

上面的代码实现了三角形箭头效果,实现的原理就是设置边框的透明。

回复

我来回复
  • 暂无回复内容