rem布局方式

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <style>
        /* 当屏幕上页面宽度大于等于800px属性会生效 */
        @media screen and (min-width:800px) {
            html {
                font-size: 14px;
                background-color: rgb(196, 30, 140);
            }
        }


        @media screen and (max-width:800px) {
            html {
                font-size: 14px;
                background-color: aqua;
            }
        }

        @media screen and (max-width:500px) {
            html {
                font-size: 10px;
                background-color: brown;
            }
        }


        /* rem等于html的字体大小 */
        div {
            text-align: center;
            height: 10rem;
            font-size: 5rem;
        }
    </style>

</head>

<body>

    <div>hello</div>
</body>

</html>
上一篇:mongodb学习日记(二)--mongodb搭建


下一篇:svn 大全