|
|
@@ -0,0 +1,93 @@
|
|
|
+<!DOCTYPE html>
|
|
|
+<html lang="en">
|
|
|
+
|
|
|
+<head>
|
|
|
+ <meta charset="UTF-8">
|
|
|
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
+ <title>Document</title>
|
|
|
+ <style>
|
|
|
+ /* css reset */
|
|
|
+ * {
|
|
|
+ margin: 0;
|
|
|
+ padding: 0;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ .fullscreen-container {
|
|
|
+ /* height: 100vh;
|
|
|
+ width: 100vw; */
|
|
|
+ background-color: #f0f4c3;
|
|
|
+ position: fixed;
|
|
|
+ top: 0;
|
|
|
+ left: 0;
|
|
|
+ right: 0;
|
|
|
+ bottom: 0;
|
|
|
+ }
|
|
|
+ .bubble-container{
|
|
|
+ width: 500px;
|
|
|
+ height: 600px;
|
|
|
+ background-color: #fff;
|
|
|
+ z-index: 1000;
|
|
|
+ position: fixed;
|
|
|
+ top: 50%;
|
|
|
+ left: 50%;
|
|
|
+ margin-top: -300px;
|
|
|
+ margin-left: -250px;
|
|
|
+ padding: 20px;
|
|
|
+ box-sizing: border-box;
|
|
|
+ }
|
|
|
+ .bottom-info{
|
|
|
+ /* 如果块元素定位后fixed 和 absolute宽度会变成内容的宽*/
|
|
|
+ position: fixed;
|
|
|
+ bottom: 0;
|
|
|
+ left: 0;
|
|
|
+ height: 50px;
|
|
|
+ width: 100%;
|
|
|
+ text-align: center;
|
|
|
+ line-height: 50px;
|
|
|
+ color: #b28704;
|
|
|
+ background-color: #fffde7;
|
|
|
+ }
|
|
|
+ .bubble-container .text{
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+ .bubble-container .text h1{
|
|
|
+ color: #689f38;
|
|
|
+ margin:20px 0;
|
|
|
+ }
|
|
|
+ .bubble-container .text .info {
|
|
|
+ width: 300px;
|
|
|
+ margin: 0 auto;
|
|
|
+ }
|
|
|
+ .bubble-container .text .desc {
|
|
|
+ font-size: 12px;
|
|
|
+ color: #999;
|
|
|
+ margin-top: 20px;
|
|
|
+ }
|
|
|
+ .bubble-container .bubble-content{
|
|
|
+ width: 100%;
|
|
|
+ height: 380px;
|
|
|
+ background-color:#b2dfdb;
|
|
|
+ margin-top: 20px;
|
|
|
+ border-radius: 20px;
|
|
|
+ }
|
|
|
+ </style>
|
|
|
+</head>
|
|
|
+
|
|
|
+<body>
|
|
|
+ <!-- 全屏容器 -->
|
|
|
+ <div class="fullscreen-container"></div>
|
|
|
+ <!-- 定位气泡容器 -->
|
|
|
+ <div class="bubble-container">
|
|
|
+ <div class="text">
|
|
|
+ <h1>趣味气泡 Position 练习</h1>
|
|
|
+ <p class="info">任务: 观察并理解气泡的定位方式,鼠标悬停气泡试试看!</p>
|
|
|
+ <p class="desc">(气泡用 absolute,气泡区用 relative,底部说明条用 fixed)</p>
|
|
|
+ </div>
|
|
|
+ <div class="bubble-content"></div>
|
|
|
+ </div>
|
|
|
+ <!-- 底部信息 -->
|
|
|
+ <div class="bottom-info">本页面用于练习 position: relative / absolute / fixed 及 hover/伪元素效果</div>
|
|
|
+</body>
|
|
|
+
|
|
|
+</html>
|