当前位置:网站首页>Explore the conversion between PX pixels and Pt pounds, mm and MM
Explore the conversion between PX pixels and Pt pounds, mm and MM
2022-07-03 02:02:00 【Fixed bolt】
List of articles
Pixel as a size of image , Only exists in computers , Like RGB Like color patterns, they only exist in computers . A pixel is a virtual unit , There is no pixel unit in real life .
In reality, we see a person , Can you say how many pixels tall it is ? You can't , Usually we say he has 1.82 Meter high , perhaps 182 Centimeter etc . All used are traditional length units . The traditional unit of length is millimeter 、 centimeter 、 Decimeter 、 rice 、 km 、 Light year and other units .
DPI(Dots Per Inch)
Pixels per inch . When scanning and printing, there are generally DPI Optional .Windows The system default is 96dpi,Apple The system default is 72dpi.
px Pixels (Pixel)
Relative length unit . It's a virtual unit of length . It's the unit of digital image length of a computer system , If px To convert to physical length , You need to specify precision DPI.
em
Due to the difference of screen size , The display effect of the same size font under different screens is quite different . So dynamic amplification / Reducing the font becomes more important . Obviously, it is complex to make compatibility for every font setting , So there was em and rem.
em It's a unit of relative length . Relative to the font size of the text in the current object .
For example, the font size of the current inline text is not set artificially , Relative to the browser's default font size .
Because the default font size of the browser is 16px, Therefore, browsers that have not adjusted the default font size conform to : 1em = 16px.
em Inherits the font size of the parent element . thus , Just change the font size of the parent element , You can synchronously enlarge or shrink the font of small elements .
But there are also a few points to pay attention to :
- body The selector declares Font-size=62.5% (10 ÷ 16 × 100% = 62.5%);
- Put your original px Number divided by 10, Then put on em As a unit ;
- Recalculate the magnified fonts em The number . Avoid repeating declaration of font size .
rem (font size of the root element)
because em There is a problem of inheriting the parent element , When changing the font size, the inheritance relationship involved becomes complicated .
rem Is the size relative to the font size of the root element . Such as The text size is set to font-size: 10px, be 1rem = 10px. Use rem Setting the font is much simpler .
in Inch (Inch)
A unit of absolute length .
pt pounds (Point)
A unit of absolute length . It's a unit of physical length , refer to 72 A quarter of an inch .
1in = 72pt
mm mm (Millimeter)
A unit of absolute length .
1in = 25.4 mm = 72pt
cm centimeter (Centimeter)
A unit of absolute length .
1in = 2.54cm = 72pt
pt And px Conversion formula
pt and px The conversion formula of can be based on pt The definition of comes to :
pt = 1/72( Inch ), px = 1/dpi( Inch )
therefore pt = px * dpi / 72
With Windows Under the 96dpi To calculate
pt = px * 96/72 = px * 4/3 = px * 1.33
Basically 1pt About equal to 1.33 Pixels
mm And px Conversion formula
from pt = px * dpi / 72
Then you know 1in = 25.4mm = 72pt
be 25.4mm/72 = px * dpi / 72
have to mm = px * dpi / 25.4
With Windows Under the 96dpi To calculate
mm = px * 96 / 25.4
mm = px * 3.78
Basically 1 mm About equal to 3.78 Pixels
边栏推荐
- 502 (bad gateway) causes and Solutions
- 【Camera专题】Camera dtsi 完全解析
- How to refresh the opening amount of Oracle ERP
- Caused by: com. fasterxml. jackson. databind. exc.MismatchedInputException: Cannot construct instance o
- mysql
- Network security - scanning and password explosion 2
- File class (check)
- Niuniu's ball guessing game (dynamic planning + prefix influence)
- Visualisation de l'ensemble de données au format yolov5 (fichier labelme json)
- 详细些介绍如何通过MQTT协议和华为云物联网进行通信
猜你喜欢
The testing process that software testers should know
[camera topic] turn a drive to light up the camera
How to deal with cache hot key in redis
Some functions of applet development
What are the key points often asked in the redis interview
Wechat applet Development Tool Post net:: Err Proxy Connexion Problèmes d'agent défectueux
stm32F407-------ADC
His experience in choosing a startup company or a big Internet company may give you some inspiration
Vant implements a simple login registration module and a personal user center
One of the C language practical projects is greedy snake
随机推荐
mysql
[data mining] task 1: distance calculation
[shutter] shutter debugging (debugging fallback function | debug method of viewing variables in debugging | console information)
"Jetpack - livedata parsing"
网络安全-动态路由协议RIP
网络安全-病毒
Ni visa fails after LabVIEW installs the third-party visa software
机器学习笔记(持续更新中。。。)
Everything file search tool
Bottleneck period must see: how can testers who have worked for 3-5 years avoid detours and break through smoothly
Network security - Information Collection
Everything文件搜索工具
Types of map key and object key
去除网页滚动条方法以及内外边距
网络安全-信息收集
502 (bad gateway) causes and Solutions
疫情当头,作为Leader如何进行团队的管理?| 社区征文
网络安全-木马
[fluent] fluent debugging (debug debugging window | viewing mobile phone log information | setting normal breakpoints | setting expression breakpoints)
Learn BeanShell before you dare to say you know JMeter