fengchuanyu 13 hodín pred
rodič
commit
00da93421c
1 zmenil súbory, kde vykonal 88 pridanie a 0 odobranie
  1. 88 0
      7_移动端/练习2_响应式布局.html

+ 88 - 0
7_移动端/练习2_响应式布局.html

@@ -0,0 +1,88 @@
+<!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>
+        body{
+            margin: 0;
+        }
+        .container{
+            max-width: 980px;
+            margin: 0 auto;
+        }
+        img{
+            display: none;
+            width: 100%;
+        }
+        @media screen and (min-width:961px){
+            .img1{
+                display: block;
+            }
+        }
+        @media screen and (max-width:960px) and (min-width:481px) {
+            .img2{
+                display: block;
+            }
+        }
+        @media screen and (max-width:480px) {
+            .img3{
+                display: block;
+            }
+            .container .content{
+                flex-wrap: wrap;
+            }
+            .container .content section{
+                width: 100%;
+                margin-right: 0;
+                margin-bottom: 20px;
+            }
+            .container .content aside{
+                width: 100%;
+            }
+        }
+        header,nav,footer{
+            background-color: #ccc;
+            height: 50px;
+            color: #fff;
+            font-size: 30px;
+            line-height: 50px;
+            font-weight: bold;
+            text-align: center;
+            margin-bottom: 20px;
+        }
+        .content{
+            display: flex;
+            margin: 20px 0;
+        }
+        .content section{
+            width: 55%;
+            margin-right: 5%;
+            height: 200px;
+            background-color: red;
+        }
+        .content aside{
+            width: 40%;
+            height: 200px;
+            background-color: blueviolet;
+        }
+    </style>
+</head>
+<body>
+    <div class="container">
+        <header>头部</header>
+        <nav>导航</nav>
+        <section>
+            <img class="img1" src="./img/1.jpg" alt="img">
+            <img class="img2" src="./img/2.jpg" alt="img">
+            <img class="img3" src="./img/3.jpg" alt="img">
+        </section>
+        <div class="content">
+            <section>IE8 及更早IE版本无法在这些元素中渲染CSS效果,以至于你不能使用 或者其他的HTML5 elements.IE8 及更早IE版本无法在这些元素中渲染CSS效果,以至于你不能使用 或者其他的HTML5 elements.</section>
+            <aside>IE8 及更早IE版本无法在这些元素中渲染CSS效果,以至于你不能使用 或者其他的HTML5 elements.IE8 及更早IE版本无法在这些元素中渲染CSS效果,以至于你不能使用 或者其他的HTML5 elements.</aside>
+        </div>
+        <footer>尾部</footer>
+    </div>
+</body>
+</html>