css帶有空心箭頭矩形效果

antzone發表於2017-04-12

分享一段程式碼例項,它實現了帶有箭頭的空心矩形效果。

程式碼例項如下:

[HTML] 純文字檢視 複製程式碼執行程式碼
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="author" content="http://www.softwhy.com/" />
<title>螞蟻部落</title>
<style>
.tipbox:before, .tipbox:after {
  content: "";
  position: absolute;
  border-style: dashed dashed solid dashed;
  line-height: 1;
  display: inline-block;
}
.tipbox:after {
  left: 75px;
  border-color: transparent transparent #D7DADB;
  border-width: 11px;
  top: -22px;
  z-index: 1080;
}
.tipbox:before {
  left: 76px;
  border-color: transparent transparent #FFF;
  border-width: 10px;
  top: -19px;
  z-index: 1081;
}
.tipbox {
  position: absolute;
  top: 30px;
  left: 65px;
  width: 150px;
  height: 100px;
  color: #0DBA8F;
  background-color: #FFF;
  border: 1px solid #D7DADB;
  display: block;
  padding: 5px;
  text-align: center;
  border-radius: 2px;
}
</style>
</head>
<body>
  <div class="tipbox"></div>
</body>
</html>

相關文章