zoukankan      html  css  js  c++  java
  • CSS3 div水平、垂直居中,IE9以上、Firefox、Chrome均正常

    <!DOCTYPE html>
    <html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>水平、垂直居中Div</title>
        <meta charset="utf-8" />
        <style>
            .CenterBox {
                position: fixed;
                top: 40%;
                left: 50%;
                background-color: #eee;
                border-radius: 15px;
                padding: 15px;
                width: 350px;
                -webkit-transform: translateX(-50%) translateY(-50%);
                -moz-transform: translateX(-50%) translateY(-50%);
                -ms-transform: translateX(-50%) translateY(-50%);
                transform: translateX(-50%) translateY(-50%);
            }
        </style>
    </head>
    <body>
        <div class="CenterBox">
            asd
        </div>
    </body>
    </html>
  • 相关阅读:
    Web开发规范
    选择器优先级计算
    CSS 技巧
    CSS3滤镜
    CSS3动画
    css3 <3D 转换>
    CSS3 2D 转换
    CSS3文本(text)模型
    CSS3颜色和渐变
    王道8.6
  • 原文地址:https://www.cnblogs.com/ZC_Mo-Blog/p/5436811.html
Copyright © 2011-2022 走看看