zoukankan      html  css  js  c++  java
  • html 布局,上下各100px,中间自适应

    flex

    <!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: 0px;
            padding: 0px;
            height: 100vh;
            display: flex;
            flex-direction: column;
          }
          .top,
          .bottom {
            height: 100px;
            background-color: red;
          }
          .center {
            background-color: pink;
            flex: 1;
          }
        </style>
      </head>
      <body>
        <div class="top"></div>
        <div class="center"></div>
        <div class="bottom"></div>
      </body>
    </html>
    

    绝对定位

    <!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>
          html,
          body {
            margin: 0px;
            padding: 0px;
            height: 100vh;
            position: relative;
            overflow: hidden;
          }
          .top,
          .bottom {
            height: 100px;
            background-color: red;
          }
          .top {
            position: absolute;
            left: 0;
            top: 0;
             100%;
          }
          .bottom {
            position: absolute;
            left: 0;
            bottom: 0;
             100%;
          }
          .center {
            box-sizing: border-box;
             100%;
            height: 100%;
            padding: 100px 0;
          }
    
          .content {
            height: 100%;
            background-color: blue;
             100%;
          }
        </style>
      </head>
      <body>
        <div class="top"></div>
        <div class="center">
          <div class="content"></div>
        </div>
        <div class="bottom"></div>
      </body>
    </html>
    

    grid

    <!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>
          html,
          body {
            margin: 0px;
            padding: 0px;
            height: 100vh;
            overflow: hidden;
            display: grid;
            grid-template-rows: 100px auto 100px;
          }
          .top,
          .bottom {
            background-color: rgba(255, 0, 0, 0.5);
          }
          .center {
            background-color: blue;
          }
        </style>
      </head>
      <body>
        <div class="top"></div>
        <div class="center"></div>
        <div class="bottom"></div>
      </body>
    </html>
    
  • 相关阅读:
    Spring总结九:事务管理机制
    Spring总结七:AOP动态代理的实现
    Spring总结六:AOP(面向切面编程)
    Nginx静态网站的部署
    Spring总结五:小结 使用spring访问servlet
    javascript 的dateObj.getTime() 在为C#的获取方式
    操作JavaScript数组
    判断是否是对象的原型
    JavaScript判断对象 是什么类型的.
    Javascript中类型: undefined, number ,string ,object ,boolean
  • 原文地址:https://www.cnblogs.com/ajanuw/p/12487726.html
Copyright © 2011-2022 走看看