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
1. Find the mysql image docker ps 2. Enter the mi...
This article uses examples to illustrate the pitf...
Create a user: create user 'oukele'@'...
How to make tomcat support https access step: (1)...
Table of contents 1. Core 1. Get the Dom node 2. ...
Table of contents Preface Scenario Analysis Summa...
MySQL Performance Optimization MySQL performance ...
Effective solution for Ubuntu in virtual machine ...
For example: <link rel="stylesheet" h...
CSS writing order 1. Position attributes (positio...
Preface During the development process, we often ...
<br />The official version of Baidu Encyclop...
New Questions Come and go in a hurry. It has been...
Table of contents 1. Add packaging command 2. Run...
Mini Program Custom Scroll-View Scroll Bar Withou...