CSS帶有箭頭的對話方塊效果

admin發表於2017-05-10

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

程式碼例項如下:

[HTML] 純文字檢視 複製程式碼執行程式碼
<!DOCTYPE html>
<html>
<head>
<meta charset=" utf-8">
<meta name="author" content="http://www.softwhy.com/" />
<title>螞蟻部落</title>
<style>
.commonProblem-title {
  color: #32c5d2;
  font-size: 19px;
  margin: 10px 20px;
}
.commonProblem-list {
  color: #737373;
}
.commonProblem-close {
  margin: 5px;
}
.commonProblem-dialog {
  position: relative;
  width: 200px;
  border: 1px solid #a9a9a9;
  margin-left: 45px;
  background-color: #fff;
}
.commonProblem-dialog:before {
  position: absolute;
  content: "";
  width: 0;
  height: 0;
  left: -59px;
  top: 28px;
  border-top: 20px solid transparent;
  border-right: 59px solid #a9a9a9;
}
.commonProblem-dialog:after {
  position: absolute;
  content: "";
  width: 0;
  height: 0;
  left: -51px;
  top: 29px;
  border-top: 18px solid transparent;
  border-right: 51px solid #fff;
}
</style>
</head>
<body>
  <div class="commonProblem-dialog">
    <div class="pull-left">
      <p class="commonProblem-title">螞蟻部落</p>
      <ul class="commonProblem-list">
        <li>螞蟻部落一</li>
        <li>螞蟻部落二</li>
      </ul>
    </div>
    <div class="pull-right">
    </div>
    <div style="clear: both"></div>
  </div>
</body>
</html>

相關文章