WEB

本文详细介绍了如何使用CSS媒体查询实现不同屏幕宽度下网页布局的变换,包括使用百分比、固定宽度和响应式设计技巧。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>变换宽度</title>
<style  type="text/css">
    #invo{
        text-align:center;
        margin:auto;
        width:750px;
    }
    #invo>div{
        border :1px solid #aaf;
        text-align:left;
        box-sizing:border-box;
        -moz-box-sizing: border-box;
        border-radius:12px 12px 0px 0px;
        background-color: #ffc;
        padding: 5px;
        }
    div#left{
        width: 300px;
        height: 230px;
        float:left;
        }
    div#right{
        width: 750px;
        float: left;
        }
    @media screen and (min-width:1000px){
        #invo{
            text-align:center;
            margin:auto;
            width:960px;
            }
        #invo>div{
            border:1px solid #aaf;
            box-sizing:border-box;
            -moz-box-sizing: border-box;
            border-radius:12px 12px 0px 0px;
            background-color: #ffc;
            paddig:5px;
            }   
        div#left{
        width:240px;
        height:240px;
        float:left;
        }
        div#right{
        width:260px;
        height:240px;
        float:left;
        }
    }
    @media screen and (max-width:480px){
        #invo{
            text-align:center;
            margin:auto;
            width:450px;
            }
        #invo>div{
            border:1px solid #aaf;
            box-sizing:border-box;
            -moz-box-sizing:border-box;
            border-radius: 12px 12px 0px 0px;
            background-color:#ffc;
            paddig:5px;
            }   
        div#left{
        width:450px;
        height:140px;
        float:left;
        }
        div#right{
        width:450px;
        height:160px;   
        float:left;
        }
    }   
</style>

</head>

<body>
    <div id="invo">
        <div id="left">
            <h2>1111111111111111111</h2>
            <ul>
                <li>2016-11-10&nbsp;1111111</li>
                <li>2016-12-10&nbsp;1111111</li>
                <li>2016-12-11&nbsp;1111111</li>
             </ul>  
        </div>
        <div id="right">
        <h2>right</h2>
         <ul>
                <li>11111111111111111</li>
                <li>22222222222222222</li>
                <li>33333333333333333</li>
                <li>1111111111111111111</li>
            </ul>  
        </div>
     </div>
</body>
</html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值