美文网首页
Div垂直竖直方向居中方案

Div垂直竖直方向居中方案

作者: 慢悠悠地丑小鸭 | 来源:发表于2017-06-30 10:51 被阅读0次
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Test Document</title>
    <style type="text/css" media="screen">
    .father{
        position:fixed;
        width:100%;
        height:100%;
        top:0;
        left:0;
        background-color:rgba(0,0,0,.7);
    }
    .son{
        position: absolute;
        top:0;
        left:0;
        bottom:0;
        right:0;
        width:80%;
        height:50%;
        margin:auto;
        border-radius: 5px;
        background-color:#ffffff;
    }
    </style>
</head>
<body>
    <div class="father">
        <div class="son"></div>
    </div>
</body>
</html>

相关文章

  • Div垂直竖直方向居中方案

  • css div垂直居中

    方案一:div绝对定位水平垂直居中【margin:auto实现绝对定位元素的居中】, 方案二:div绝对定位水平垂...

  • CSS水平垂直居中总结

    CSS水平居中、垂直居中、水平垂直居中方法总结 文字的水平居中: 单行文字的垂直居中: 让有宽度的div水平居中:...

  • DIV+CSS布局

    布局效果: 1)设置垂直方向的三个div,宽度均设为100%,里面文字居中 2)设置水平方向的div,利用floa...

  • flex布局实现css垂直方向居中

    情景:多行文本想在div中垂直居中方案1(设置为table布局): 方案2(设置为flex布局):

  • html div>img img不能居中问题

    line-height不能解决img在div内垂直居中,div 加入下面css代码,可以实现img垂直居中了 文字...

  • CSS居中大全(带截图)

    文字水平居中 图片水平垂直居中 图片与文字水平垂直居中 代码同上 DIV相对于页面垂直居中并且响应式 视口绝对垂直...

  • 图片在div垂直水平居中兼容解决方案

    来源:http://itssh.cn/post/935.html 图片在div垂直水平居中兼容解决方案:案例: 效...

  • 2018-05-23

    div高度不固定,垂直居中的方法-汇总 1、高度宽度不固定,内容区域垂直居中

  • div垂直居中的方法

    1、div中单行文字的垂直居中 在div中单行的文字需要垂直居中时,只需要对所在的div添加行高line-heig...

网友评论

      本文标题:Div垂直竖直方向居中方案

      本文链接:https://www.haomeiwen.com/subject/ygubcxtx.html