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>

  • 相关阅读:
    Python pip配置国内源
    【VLC】VLC命令行参数
    发个在owasp上演讲web应用防火墙的ppt
    Tips of Linux C programming
    linux程序调试
    scrapy结合webkit抓取js生成的页面
    Using Internet Explorer from .NET
    http长连接200万尝试及调优
    nginx url解码引发的waf漏洞
    poj 2513
  • 原文地址:https://www.cnblogs.com/ai3xiaoyi/p/3932935.html
Copyright © 2011-2022 走看看