CSS3 syntax: (1rem = 100px for a 750px design) @media only screen and (min-width: 320px) and (max-width: 479px) { html { font-size: 42.67px !important; } } @media only screen and (min-width: 480px) and (max-width: 639px) { html { font-size: 64px !important; } } @media only screen and (min-width: 640px) and (max-width: 749px) { html { font-size: 85.34px !important; } } @media only screen and (min-width: 750px) and (max-width: 959px) { html { font-size: 100px !important; } } @media only screen and (min-width: 960px) and (max-width: 1241px) { html { font-size: 128px !important; } } @media only screen and (min-width: 1242px) { html { font-size: 165.6px !important; } } js control (zepto/jQuery) (1rem = 100px for a 750px design) function setFont() { let window_width = window.innerWidth; let font_size = parseFloat(window_width / 3.75); $('html').css('font-size', font_size); } $(window).on('resize', function () { setFont(); }); Summarize The above is what I introduced to you about media queries in CSS3 combined with rem layout to adapt to mobile phone screens. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time! |
<<: Docker solution for logging in without root privileges
>>: Detailed explanation of MySQL backup process using Xtrabackup
Table of contents The significance of standard co...
I am using LDAP user management implemented in Ce...
Which historical version can the current transact...
Win10 installs mysql5.7 decompressed version, for...
DTD is a set of grammatical rules for markup. It i...
Chinese characters cannot be input in lower versio...
1. Set up a shared folder on the virtual machine:...
The div+css layout to achieve 2-end alignment is ...
1. Brief Introduction of Nginx Nginx is a free, o...
This article uses examples to illustrate how to v...
Table of contents Preface Code Implementation Ide...
It's embarrassing to say that I had to search ...
Recently, due to work needs, I need to format num...
Table of contents Preface 1. Download MySQL 8.0.2...
Table of contents Preface 1. First completely uni...