zoukankan      html  css  js  c++  java
  • 任意长宽度子div在任意长宽度父div垂直水平居中

    <DocType html>
    <html>
        <head>
            <title>任意长宽度高度垂直水平居中div</title>
            <style>
                .parentDiv{
                    500px;<!-- 长宽可以改变-->
                    height:500px;
                    margin:0 auto;
                    background:blue;            
                }
                .childDiv{
                    200px;<!-- 长宽可以改变-->
                    height:200px;
                    position:relative;
                    top:50%;
                    left:50%;
                }
                .lastChildDiv {
                    100%;
                    height:100%;
                    position:relative;
                    right:50%;
                    background:red;
                    bottom:50%;
                }
            
            </style>
        </head>
        
        <div class="parentDiv"><!--父div-->
            <div class="childDiv"><!-- 过渡div-->
                 <div class="lastChildDiv"></div><!-- 子div-->
            </div>
        </div>

    </html>

  • 相关阅读:
    创建类以及引用一个类
    修改hosts文件
    微信第三方登录接口开发
    Android定位
    Leetcode 102. Binary Tree Level Order Traversal
    Leetcode 725. Split Linked List in Parts
    Leetcode 445. Add Two Numbers II
    Leetcode 328. Odd Even Linked List
    Leetcode 237. Delete Node in a Linked List
    Leetcode 234. Palindrome Linked List
  • 原文地址:https://www.cnblogs.com/ai3xiaoyi/p/3932935.html
Copyright © 2011-2022 走看看