当前位置:网站首页>The causes of font and style enlargement when the applet is horizontal have been solved
The causes of font and style enlargement when the applet is horizontal have been solved
2022-06-13 06:39:00 【A-linWeb】
About why applets cannot be triggered by click events
Since the horizontal screen needs to be modified json Configuration of files , This file cannot be modified while the program is running , So we can't rotate the mobile screen by clicking a button or other operations , It is just set to "pageOrientation":
"auto" The user actively rotates the mobile phone to trigger .
About applet rpx The definition of
We all know , Wechat applet is in vertical screen state , Width 100%,100VW The value of is 750rpx. But after the horizontal screen ,750rpx The actual width of is the height of the mobile screen .
under these circumstances , Our interface will get bigger .
A simple example , If the aspect ratio of the mobile phone screen is 1:2, We have a button size of 100rpx100rpx, So in the vertical screen state , According to the normal , In the horizontal screen state , The display width and height of the button will change to the original 2 times , Of course he's still 100rpx100rpx, But the display is getting bigger .

Vertical screen status is used rpx Make a layout 
Solution
Use vmin To deal with ( Very vertical font 、 The style is the same as the horizontal screen )
rpx And vmin The conversion relationship of :5rpx Equivalent calc(5vmin * 100 / 750)== Simple writing ==>>5rpx Equivalent calc(5vmin / 7.5)
vmax Relative to the larger of the width or height of the viewport . The biggest one is divided equally into 100 The unit of vmax
vmin The smaller of the width or height of the viewport . The smallest of these is equally divided 100 The unit of vmin
Here we only use vmin.
When we are on the vertical screen ,100vmin The value of is the screen width of the mobile phone , When the screen is horizontal ,100vmin The value of is still the screen width of the mobile phone , So vmin Elements in units , When the mobile phone screen rotates , The display size does not change ( After all, no matter the horizontal or vertical screen ,100vmin Is equal to the width of the screen ).
In the use of rpx When doing layout ,750rpx The value of is the width of the mobile phone screen , But in the use of vmin when ,100vmin The value of is the width of the mobile phone screen , therefore ,rpx and vmin There is a conversion relationship between , namely :x rpx=( x * 100 / 750)vmin. for instance ,75rpx Turn into vmin by 75 * 100 / 750 = 10 vmin. therefore , We just need to rpx Turn it into vmin You can have a happy code page ~
Use scss To convert
//css function
@function tovmin($rpx){
//$rpx For the font size to be converted
@return #{
$rpx * 100 / 750}vmin;
}
// Usage mode .slideAddPanel {
width: tovmin(48);
height: tovmin(80);
background: rgba(0, 0, 0, 0.5);
box-shadow: 0 tovmin(2) tovmin(12) 0 rgba(0, 0, 0, 0.2);
line-height: tovmin(80);
border-radius: 0 tovmin(10) tovmin(10) 0;
}
边栏推荐
- 数据在内存中的存储(C语言)
- Usegeneratedkeys=true configuration
- App performance test: (II) CPU
- Cross process two-way communication using messenger
- Kotlin collaboration channel
- Kotlin collaboration - simple use of collaboration
- Uniapp (upload local pictures, preview pictures, convert Base64 format, upload audio files)
- Failed to extract manifest from apk: processexception:%1 is not a valid Win32 Application.
- Pngquant batch bat and parameter description
- Ijkplayer code walk through H264 unpacker application details
猜你喜欢

十五、IO流(一)

《MATLAB 神经网络43个案例分析》:第10章 离散Hopfield神经网络的分类——高校科研能力评价
![[SketchUp 2021] CAD file import and modeling in the sketch master (establish elevation model in the sketch master by using CAD drawings), and the sketch master exports 2D, 3D and elevation effects of](/img/de/d0620a43c47a06d815c21ecb41a117.png)
[SketchUp 2021] CAD file import and modeling in the sketch master (establish elevation model in the sketch master by using CAD drawings), and the sketch master exports 2D, 3D and elevation effects of

'ipconfig' is not an internal or external command, nor is it a runnable program or batch file.

MFS details (vii) - - MFS client and Web Monitoring installation configuration

JetPack - - -WorkManger

无刷直流电机矢量控制(四):基于滑模观测器的无传感器控制

‘ipconfig‘ 不是内部或外部命令,也不是可运行的程序 或批处理文件。

Analysis of 43 cases of MATLAB neural network: Chapter 10 classification of discrete Hopfield Neural Network -- evaluation of scientific research ability of colleges and Universities
![[solution] camunda deployment process should point to a running platform rest API](/img/ef/5b893e9c315c10db6c1db46b4c3f5a.jpg)
[solution] camunda deployment process should point to a running platform rest API
随机推荐
Learning records countless questions (JS)
智能金融再升级,景联文科技提供数据采集标注服务
Cocos released the oppo game prompt "subcontracting failed"
【虚拟机】 VMware虚拟机占用空间过大解决
无刷直流电机矢量控制(四):基于滑模观测器的无传感器控制
[solution] camunda deployment process should point to a running platform rest API
JS to realize bidirectional data binding
景联文科技:数据标注行业现状及解决方案
Hidden and wx:if
动态链接库嵌套样例
Thread pool learning
The processing and application of C language to documents
Failed to extract manifest from apk: processexception:%1 is not a valid Win32 Application.
Win10 drqa installation
[kernel] two methods of driver compilation: compiling into modules and compiling into the kernel (using miscellaneous device driver templates)
時間格式化工具----moment.js(網頁時間實時展示)
Analyzing server problems using jvisualvm
Interface oriented programming in C language
Custom view subtotal
景联文科技:数据采集标注行业现状及解决方案