移动端字体重设

本文介绍了一种响应式网页设计中根据不同屏幕宽度调整字体大小的方法。通过使用媒体查询,针对不同设备分辨率设置不同的字体尺寸,确保了良好的用户体验。

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

body {
            font-size: 18px;
        }

        @media only screen and (max-width: 300px) {
            body {
                font-size: 16.666666px;
            }
            .viewport {
                max-width: 300px;
            }
        }

        @media only screen and (max-width: 310px) and (min-width: 300px) {
            body {
                font-size: 16.666666px;
            }
            .viewport {
                max-width: 310px;
            }
        }

        @media only screen and (max-width: 320px) and (min-width: 310px) {
            body {
                font-size: 17.22222px;
            }
            .viewport {
                max-width: 320px;
            }
        }

        @media only screen and (max-width: 350px) and (min-width: 320px) {
            body {
                font-size: 17.77778px;
            }
            .viewport {
                max-width: 350px;
            }
        }

        @media only screen and (max-width: 360px) and (min-width: 350px) {
            body {
                font-size: 19.44444px;
            }
            .viewport {
                max-width: 360px;
            }
        }

        @media only screen and (max-width: 400px) and (min-width: 360px) {
            body {
                font-size: 20px;
            }
            .viewport {
                max-width: 400px;
            }
        }

        @media only screen and (max-width: 470px) and (min-width: 400px) {
            body {
                font-size: 22.22222px;
            }
            .viewport {
                max-width: 470px;
            }
        }

        @media only screen and (max-width: 480px) and (min-width: 470px) {
            body {
                font-size: 26.11112px;
            }
            .viewport {
                max-width: 480px;
            }
        }

        @media only screen and (max-width: 540px) and (min-width: 480px) {
            body {
                font-size: 26.66666px;
            }
            .viewport {
                max-width: 540px;
            }
        }

        @media only screen and (max-width: 560px) and (min-width: 540px) {
            body {
                font-size: 30px;
            }
            .viewport {
                max-width: 560px;
            }
        }

        @media only screen and (max-width: 570px) and (min-width: 560px) {
            body {
                font-size: 31.11112px;
            }
            .viewport {
                max-width: 570px;
            }
        }

        @media only screen and (max-width: 630px) and (min-width: 570px) {
            body {
                font-size: 31.66666px;
            }
            .viewport {
                max-width: 630px;
            }
        }

        @media only screen and (max-width: 640px) and (min-width: 630px) {
            body {
                font-size: 35px;
            }
            .viewport {
                max-width: 640px;
            }
        }

        @media only screen and (max-width: 710px) and (min-width: 640px) {
            body {
                font-size: 35.55556px;
            }
            .viewport {
                max-width: 710px;
            }
        }

        @media only screen and (max-width: 720px) and (min-width: 710px) {
            body {
                font-size: 39.44444px;
            }
            .viewport {
                max-width: 720px;
            }
        }

        @media only screen and (min-width: 720px) {
            body {
                font-size: 40px;
            }
            .viewport {
                width: 720px;
            }
        }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值