Skip to content

Instantly share code, notes, and snippets.

@qzm
Created December 8, 2016 14:29
Show Gist options
  • Save qzm/c2ad2946d79bffc044f9d343be5c9781 to your computer and use it in GitHub Desktop.
Save qzm/c2ad2946d79bffc044f9d343be5c9781 to your computer and use it in GitHub Desktop.
带三角形的popup
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
.popup {
/* 垂直,水平居中 */
position: absolute;
top: 50%;
left: 50%;
margin-left: -150px;
margin-top: -60px;
/* 样式 */
border: 1px #CCC solid;
border-radius: 5px;
box-shadow: 5px 5px 5px #DDD;
width: 300px
}
.popup-header,
.popup-body {
padding: 5px 10px;
}
.popup-header {
font-size: 24px;
background-color: #EEE;
border-radius: 5px 5px 0 0;
font-weight: bold;
border-bottom: 1px #CCC solid;
}
.popup-triangl-frent,
.popup-triangl-back {
position: absolute;
left: 130px;
height: 0;
width: 0;
border-width: 15px;
border-style: solid;
}
.popup-triangl-back {
top: -30px;
border-color: transparent transparent #CCC transparent;
}
.popup-triangl-frent {
top: -28px;
border-color: transparent transparent #eee transparent;
}
</style>
</head>
<body>
<div class="popup">
<div class="popup-header">
<div>Title</div>
</div>
<div class="popup-body">
<p>Paragraph</p>
<p>Paragraph</p>
<p>Paragraph</p>
</div>
<div class="popup-triangl-back"></div>
<div class="popup-triangl-frent"></div>
</div>
</body>
</html>
@qzm
Copy link
Author

qzm commented Dec 8, 2016

screen shot 2016-12-08 at 22 29 31

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment