zoukankan      html  css  js  c++  java
  • 学习手机页面制作5

    使用padding-bottom 实现高度自适应

     1 <!DOCTYPE html>
     2 <html lang="zh">
     3 <head>
     4     <meta charset="UTF-8">
     5     <title>height auto</title>
     6     <!-- 加入meta viewport -->
     7     <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
     8     <style>
     9     *{
    10         padding:0;
    11         margin:0;
    12     }
    13     #box{
    14         height:45px;
    15         width:100%;
    16         background: #f30;
    17         display:-webkit-box;
    18         position:relative;
    19     }
    20     #logo{
    21         width:100px;
    22         background: #f00;
    23         height:45px;
    24         display:block;
    25 
    26 
    27 
    28     }
    29     #nav{
    30         -webkit-box-flex: 1;
    31         -moz-box-flex: 1;
    32         -ms-box-flex: 1;
    33         box-flex: 1;
    34     }
    35     #btn{
    36         width:50px;
    37         background: blue;
    38     }
    39     .list{
    40         width:100%;
    41         
    42     }
    43     .list ul{
    44         display:-webkit-box;
    45         list-style-type: none;
    46     }
    47     .list li{
    48         -webkit-box-flex: 1;
    49         -moz-box-flex: 1;
    50         -ms-box-flex: 1;
    51         box-flex: 1;
    52         background: #eee;
    53         width:30%;
    54         margin-right:3%;
    55         /*设置高度为0 padding-bottom:30% 参考的也是父亲的高度*/
    56         height:0;
    57         /*width/height*区域的图片高度*/
    58         padding-top:30%;
    59     }
    60     </style>
    61 </head>
    62 <body>
    63 <!-- h1里面写文字 用text-indent 利用seo -->
    64     <div id="box">
    65         <dix id="logo">logo</dix>
    66         <div id="nav"></div>
    67         <div id="btn"></div>
    68     </div>
    69     <div class="list">
    70         <ul>
    71             <li><img src="" alt=""></li>
    72             <li></li>
    73             <li></li>
    74         </ul>
    75     </div>
    76 </body>
    77 </html>
  • 相关阅读:
    51nod1229 序列求和 V2
    51nod 1228、1258 序列求和
    题解P3711:【仓鼠的数学题】
    伯努利数学习笔记的说...
    题解 P4692 【[Ynoi2016]谁的梦】
    积性函数与卷积
    题解 P5065 【[Ynoi2014]不归之人与望眼欲穿的人们】
    [Ynoi2018]末日时在做什么?有没有空?可以来拯救吗?
    [51nod1965]奇怪的式子
    PGCD2
  • 原文地址:https://www.cnblogs.com/tl542475736/p/4285164.html
Copyright © 2011-2022 走看看