rem的用法_html/css_WEB-ITnose

WBOY
發布: 2016-06-24 11:36:22
原創
1061 人瀏覽過

rem 是css3中的属性,ie8下不兼容。
rem是相对于根元素  这就意味着我们只需要在 根目录加入以下css代码。 默认单位为16px,我们需要在用rem的时候除以16  就是rem的值。  比如字体是20px,

 20÷16 = 1.25rem即可。

@media only screen and (max-width: 320px) {    html {        font-size: 16px;    }}@media only screen and (min-width: 321px) and (max-width: 360px) {    html {        font-size: 18px;    }}@media only screen and (min-width: 361px) and (max-width: 375px) {    html {        font-size: 18.75px;    }}@media only screen and (min-width: 376px) and (max-width: 384px) {    html {        font-size: 19px;    }}@media only screen and (min-width: 385px) and (max-width: 413px) {    html {        font-size: 19px;    }}@media only screen and (min-width: 414px) and (max-width: 480px) {    html {        font-size: 20.7px;    }}@media only screen and (min-width: 481px) and (max-width: 540px) {    html {        font-size: 27px;    }}
登入後複製

 

推荐前端交流群: 群号:339840649; 群名称:html5/css3/js/jq/nodejs/div 欢迎加入~
点击加入:

扫码加入:

相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!