zsydgithub 2 years ago
parent
commit
918298d6fc
3 changed files with 148 additions and 0 deletions
  1. 91 0
      8_移动端/5_小海豹2.html
  2. 29 0
      8_移动端/6_padding-top.html
  3. 28 0
      8_移动端/7_事件.html

+ 91 - 0
8_移动端/5_小海豹2.html

@@ -0,0 +1,91 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8">
+  <meta http-equiv="X-UA-Compatible" content="IE=edge">
+  <meta name="viewport" content="width=device-width, initial-scale=1.0">
+  <title>Document</title>
+  <style>
+    *{
+      margin: 0;
+      padding: 0;
+    }
+    h3{
+      width: 980px;
+      height: 50px;
+      background: #ccc;
+      text-align: center;
+      line-height: 50px;
+      margin: 0 auto 10px;
+    }
+    #content{
+      width: 980px;
+      margin: 10px auto;
+      overflow: hidden;
+
+    }
+    #left{
+      width: 630px;
+      height: 300px;
+      background: red;
+      float: left;
+    }
+    #right{
+      width: 340px;
+      height: 300px;
+      background: blue;
+      float: right;
+    }
+    #imgBox{
+      width: 980px;
+      height: 500px;
+      background: url(img/1.jpg) 0 0 no-repeat;
+      background-size: 100%;
+      margin: 0 auto
+    }
+    @media screen and (max-width: 980px) {
+      h3{
+        width: 100%;
+      }
+      #content{
+        width: 100%;
+      }
+      #left{
+        width: 65%;
+      }
+      #right{
+        width: 34%;
+      }
+      #imgBox{
+        width: 100%;
+        background-image: url(img/2.jpg);
+        height: 0;
+        padding-top: 56%;
+      }
+    }
+    @media screen and (max-width: 480px) {
+      #left{
+        width: 100%;
+        float: none;
+      }
+      #right{
+        width: 100%;
+        float: none;
+      }
+      #imgBox{
+        background-image: url(img/3.jpg);
+      }
+    }
+  </style>
+</head>
+<body>
+  <h3>页眉</h3>
+  <h3>导航</h3>
+  <div id="imgBox"></div>
+  <div id="content">
+    <div id="left"></div>
+    <div id="right"></div>
+  </div>
+  <h3>页尾</h3>
+</body>
+</html>

+ 29 - 0
8_移动端/6_padding-top.html

@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8">
+  <meta http-equiv="X-UA-Compatible" content="IE=edge">
+  <meta name="viewport" content="width=device-width, initial-scale=1.0">
+  <title>Document</title>
+  <style>
+    *{
+      margin: 0;
+      padding: 0;
+    }
+    #div1{
+      background: red;
+      /* width: 50%;
+      height: 100px; */
+      /* width: 50vw;
+      height: 50vh; */
+      /* padding-top  百分比  相对于宽度 */
+      width: 100%;
+      /* height: 50px; */
+      padding-top: 50%;
+    }
+  </style>
+</head>
+<body>
+  <div id="div1"></div>
+</body>
+</html>

+ 28 - 0
8_移动端/7_事件.html

@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8">
+  <meta http-equiv="X-UA-Compatible" content="IE=edge">
+  <meta name="viewport" content="width=device-width, initial-scale=1.0">
+  <title>Document</title>
+</head>
+<body>
+  123123123
+  <script>
+    
+    // document.ontouchmove = function(){
+    //   console.log('move')
+    // }
+    // document.ontouchend = function(){
+    //   console.log('touched')
+    // }
+    document.onclick = function(){
+      console.log('click')
+    }
+    document.ontouchstart = function(){
+      console.log('start')
+    }
+    /* click 事件 有300ms的延迟 */
+  </script>
+</body>
+</html>