1000字范文,内容丰富有趣,学习的好帮手!
1000字范文 > html 字号自适应 html自适应网页里字体大小自适应屏幕的方法

html 字号自适应 html自适应网页里字体大小自适应屏幕的方法

时间:2023-10-12 09:26:43

相关推荐

html 字号自适应 html自适应网页里字体大小自适应屏幕的方法

html自适应网页里字体大小自适应屏幕的方法

发布时间:-11-20 16:40:22

来源:亿速云

阅读:216

作者:小新

这篇文章主要介绍了html自适应网页里字体大小自适应屏幕的方法,具有一定借鉴价值,需要的朋友可以参考下。希望大家阅读完这篇文章后大有收获。下面让小编带着大家一起了解一下。

字体大小使用 em,rem作为单位,然后使用 media query 来调整 html 元素的 font-size

自适应网站html {font-size: 62.5%!important; /* 10÷16=62.5% */}

@media only screen and (min-width: 481px){

html {

font-size: 94%!important; /* 15.04÷16=94% */

}

}

@media only screen and (min-width: 561px){

html {

font-size: 109%!important; /* 17.44÷16=109% */

}

}

@media only screen and (min-width: 641px){

html {

font-size: 125%!important; /* 20÷16=125% */

}

}

app@media only screen and (min-width: 320px){html {font-size: 62.5%!important;}}

@media only screen and (min-width: 360px){html {font-size: 72.5%!important;}}

@media only screen and (min-width: 400px){html {font-size: 82.5%!important;}}

@media only screen and (min-width: 480px){html {font-size: 94%!important;}}

感谢你能够认真阅读完这篇文章,希望小编分享html自适应网页里字体大小自适应屏幕的方法内容对大家有帮助,同时也希望大家多多支持亿速云,关注亿速云行业资讯频道,遇到问题就找亿速云,详细的解决方法等着你来学习!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。