|
@@ -36,6 +36,82 @@
|
|
|
color: #999;
|
|
|
font-size: 12px;
|
|
|
}
|
|
|
+ .content-bubble{
|
|
|
+ width: 500px;
|
|
|
+ height: 350px;
|
|
|
+ background-color: #b2dfdb;
|
|
|
+ margin:0 auto;
|
|
|
+ border-radius: 20px;
|
|
|
+ position: relative;
|
|
|
+ }
|
|
|
+ .bubble-item{
|
|
|
+ width: 100px;
|
|
|
+ height: 100px;
|
|
|
+ background-color: #81d4fa;
|
|
|
+ border-radius: 50%;
|
|
|
+ border:3px solid #fff;
|
|
|
+ position: absolute;
|
|
|
+ top:50%;
|
|
|
+ margin-top: -50px;
|
|
|
+ left:30px;
|
|
|
+ text-align: center;
|
|
|
+ line-height: 100px;
|
|
|
+ }
|
|
|
+ .bubble-item span{
|
|
|
+ color: #fff;
|
|
|
+ }
|
|
|
+ .bubble-item::after{
|
|
|
+ content: "";
|
|
|
+ display: block;
|
|
|
+ width: 30%;
|
|
|
+ height: 20%;
|
|
|
+ background-color: #fff;
|
|
|
+ position: absolute;
|
|
|
+ top:20%;
|
|
|
+ left: 20%;
|
|
|
+ border-radius: 50%;
|
|
|
+ opacity: 0.3;
|
|
|
+ }
|
|
|
+ .bubble-item:nth-child(2){
|
|
|
+ left: 23%;
|
|
|
+ top: 40%;
|
|
|
+ background-color: #ffd54f;
|
|
|
+ width: 80px;
|
|
|
+ height: 80px;
|
|
|
+ line-height: 80px;
|
|
|
+ }
|
|
|
+ .bubble-item:nth-child(3){
|
|
|
+ left: 53%;
|
|
|
+ top: 60%;
|
|
|
+ background-color: red;
|
|
|
+ width: 60px;
|
|
|
+ height: 60px;
|
|
|
+ line-height: 60px;
|
|
|
+
|
|
|
+ }
|
|
|
+ .bubble-item:hover{
|
|
|
+ cursor: pointer;
|
|
|
+ z-index: 1;
|
|
|
+ /* 控制元素缩放 */
|
|
|
+ transform: scale(1.2);
|
|
|
+ }
|
|
|
+
|
|
|
+ /* .bubble-item:first-child:hover{
|
|
|
+ width: 108px;
|
|
|
+ height: 108px;
|
|
|
+
|
|
|
+ } */
|
|
|
+ .footer{
|
|
|
+ background-color: #fffde7;
|
|
|
+ color: #b28704;
|
|
|
+ /* 脱离文档流后的元素宽度跟内容撑开 */
|
|
|
+ position: fixed;
|
|
|
+ left: 0;
|
|
|
+ bottom: 0;
|
|
|
+ width: 100%;
|
|
|
+ text-align: center;
|
|
|
+
|
|
|
+ }
|
|
|
</style>
|
|
|
</head>
|
|
|
<body>
|
|
@@ -46,9 +122,21 @@
|
|
|
<p class="info-center"><strong>任务:</strong> 观察并理解气泡的定位方式,鼠标悬停气泡试试看!</p>
|
|
|
<p class="info-bottom">(气泡用 absolute,气泡区用 relative,底部说明条用 fixed)</p>
|
|
|
</div>
|
|
|
- <div class="content-bubble"></div>
|
|
|
+ <div class="content-bubble">
|
|
|
+ <div class="bubble-item">
|
|
|
+ <span>A</span>
|
|
|
+ </div>
|
|
|
+ <div class="bubble-item">
|
|
|
+ <span>B</span>
|
|
|
+ </div>
|
|
|
+ <div class="bubble-item">
|
|
|
+ <span>C</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="footer">
|
|
|
+ <p>本页面用于练习 position: relative / absolute / fixed 及 hover/伪元素效果</p>
|
|
|
</div>
|
|
|
- <div class="footer"></div>
|
|
|
</div>
|
|
|
</body>
|
|
|
</html>
|