当前位置 : 主页 > 网页制作 > Bootstarp >

基于 bootstrap html 响应式 布局

来源:互联网 收集:自由互联 发布时间:2021-06-12
!DOCTYPE htmlhtml lang= " zh-CN " head meta charset= " UTF-8 " titleTitle/title meta name= " viewport " content= " width=device-width, initial-scale=1 " style body{ margin: 0; } .pg{ width: 100% ; background - color: rebeccapurple; } @media
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <style>
        body{
            margin: 0;
        }
        .pg{
            width: 100%;
            background-color: rebeccapurple;
        }
        @media (min-width: 666px) {
            .pg{
                background-color: green; 
            }
        }
        
        @media (min-width: 888px) {   //大于 888 就红色
            .pg{
                background-color: red;
            }
        }
    </style>
</head>
<body>
    <div>
        <div class="pg">响应式布局</div>
    </div>
</body>
</html>
网友评论