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>
    
  • 相关阅读:
    QueryRunner查询返回值为int的数据
    c3p0连接池获取数据库连接
    javascript-文件File转换成base64格式
    php 判断是否手机端还是pc端
    MySql -- 数据结构
    tp5--路由的使用方法(深入)
    tp5--路由的使用(初级)
    tp5--开发规范
    二维数组排序 按某个字段排序
    文件记录网页访问量
  • 原文地址:https://www.cnblogs.com/ajanuw/p/12487726.html
Copyright © 2011-2022 走看看