


Webapp new experience Rem implements mobile web page adaptation detailed resource_html/css_WEB-ITnose
本来想写一篇,webapp使用Rem的问题,查了一下相关rem的介绍之后,发现很多平台已经解释的很清楚了,图文并茂,于是我便想将其解释资源整理一些,方便以后自己查阅。
腾讯ISUX:web app变革之rem(解释的最精辟了)
大漠博客:CSS3的REM设置字体大小
小黑成长录:关于webapp中的文字单位的一些捣腾
前端观察站:px em rem在WEB前端开发中的区别
最后分享一段淘宝手机屏幕尺寸判断改变字体大小的js:
!function(x) { function w() { var a = r.getBoundingClientRect().width; a / v > 540 && (a = 540 * v), x.rem = a / 16, r.style.fontSize = x.rem + "px" } var v, u, t, s = x.document, r = s.documentElement, q = s.querySelector('meta[name="viewport"]'), p = s.querySelector('meta[name="flexible"]'); if (q) { console.warn("将根据已有的meta标签来设置缩放比例"); var o = q.getAttribute("content").match(/initial\-scale=(["']?)([\d\.]+)\1?/); o && (u = parseFloat(o[2]), v = parseInt(1 / u)) } else { if (p) { var o = p.getAttribute("content").match(/initial\-dpr=(["']?)([\d\.]+)\1?/); o && (v = parseFloat(o[2]), u = parseFloat((1 / v).toFixed(2))) } } if (!v && !u) { var n = (x.navigator.appVersion.match(/android/gi), x.navigator.appVersion.match(/iphone/gi)), v = x.devicePixelRatio; v = n ? v >= 3 ? 3 : v >= 2 ? 2 : 1 : 1, u = 1 / v } if (r.setAttribute("data-dpr", v), !q) { if (q = s.createElement("meta"), q.setAttribute("name", "viewport"), q.setAttribute("content", "initial-scale=" + u + ", maximum-scale=" + u + ", minimum-scale=" + u + ", user-scalable=no"), r.firstElementChild) { r.firstElementChild.appendChild(q) } else { var m = s.createElement("div"); m.appendChild(q), s.write(m.innerHTML) } } x.dpr = v, x.addEventListener("resize", function() { clearTimeout(t), t = setTimeout(w, 300) }, !1), x.addEventListener("pageshow", function(b) { b.persisted && (clearTimeout(t), t = setTimeout(w, 300)) }, !1), "complete" === s.readyState ? s.body.style.fontSize = 12 * v + "px" : s.addEventListener("DOMContentLoaded", function() { s.body.style.fontSize = 12 * v + "px" }, !1), w()}(window);

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



The article discusses the HTML <progress> element, its purpose, styling, and differences from the <meter> element. The main focus is on using <progress> for task completion and <meter> for stati

The article discusses the HTML <datalist> element, which enhances forms by providing autocomplete suggestions, improving user experience and reducing errors.Character count: 159

HTML is suitable for beginners because it is simple and easy to learn and can quickly see results. 1) The learning curve of HTML is smooth and easy to get started. 2) Just master the basic tags to start creating web pages. 3) High flexibility and can be used in combination with CSS and JavaScript. 4) Rich learning resources and modern tools support the learning process.

The article discusses the HTML <meter> element, used for displaying scalar or fractional values within a range, and its common applications in web development. It differentiates <meter> from <progress> and ex

The article discusses the <iframe> tag's purpose in embedding external content into webpages, its common uses, security risks, and alternatives like object tags and APIs.

The article discusses the viewport meta tag, essential for responsive web design on mobile devices. It explains how proper use ensures optimal content scaling and user interaction, while misuse can lead to design and accessibility issues.

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.

AnexampleofastartingtaginHTMLis,whichbeginsaparagraph.StartingtagsareessentialinHTMLastheyinitiateelements,definetheirtypes,andarecrucialforstructuringwebpagesandconstructingtheDOM.
