11.2992 inches), divided by the horizontal resolution (I'm 1024 pixels here), and get the physical length of each pixel.Now we can answer the question, how much space does 9pt of the Web page occupy? The answer is: 9 * 1/72 * 96 * 11.2992/1024 = 0.1324 inches = 0.3363 centimeters.5. PT and PXAlthough PT is an absolute unit, it is only for output devices and is a very useful font unit in the Text Layout tool (Word,abobe). Regardless of the resolution of the Monitor, the results printed on paper
Android has many measurement units, such as commonly used dp, dip, sp, px, etc. Sometimes they need to be converted to each other. The following is a very convenient method:
For example, convert sp to px:
TypedValue. applyDimension (TypedValue. COMPLEX_UNIT_SP, value, metric );
The following is a prototype of the applyDimension function:
Float android. util. TypedValue. applyDimension (int unit, float v
[Dip: device independent pixels (device independent pixel ).
Different devices have different display effects, which are related to the hardware of the device. We recommend that you use this function to support WVGA, HVGA, and QVGA without pixels.
Px: pixels (pixels). Different devices have the same display effect. Generally, we use HVGA to represent 320x480 pixels, which is usually used.
Pt: point, a standard unit of length, 1pt = 1/72 inch, used in
Preface
Both EM and REM are flexible and extensible units, converted by the browser to pixel values, depending on the font size in the design, and if the value is 1em or 1rem, it can be converted from 16px to 160px or any other value by the browser. The browser uses 1px, then 1px is always displayed as full 1px.
The same point of EM and REM
Using EM and REM units allows us to design more flexibly and to control the overall enlargement of the elements rather than the fixed size
EM and REM diffe
In today's network era, which advocates usability design and user experience design, CSS is also involved. Most people in the CSS code is always the first definition of the overall font size, the Chinese case is generally 12px, and in fact, in this way through the IE top menu in the "View-Text size" setting has no effect. It's certainly a bad user experience for a browser with a small font feel. In fact, all this can be avoided, that is, the use of EM units as a font display units.
The browser'
DP (DIP): device independent pixels (unit independent pixels). Different devices have different display effects, this is related to the device hardware, generally we support WVGA, HVGA and QVGA recommend this, do not rely on pixels.Px:pixels (pixels). Different devices show the same effect, generally we hvga represent 320x480 pixels, this use more.Pt:point, is a standard length unit, 1pt=1/72 inches, for the printing industry, very simple to use;sp:scaled pixels (enlarge pixels). Mainly used for
/*highly adaptive based on Pixel (px), suitable for single pages*///Set the height (extend to the bottom of the browser or extend to the bottom of the reference element to set the amount of reduction)$.fn.fnsetheight =function(A, B) {if( This. length > 0) { //parameter Handling var$Reference, decrease; Switch(arguments.length) { Case0: $Reference=$ (window); Decrease= 0; Break; Case1: if(typeofA = = = ' Number ') {$Refer
Today, we want to convert Px to mm, because the size of the pixel-to-other unit ratio varies with the resolution size set on the screen, so it cannot be calculated using a fixed number.Solution:Put a hidden block with a height of 1mm on the page Then use jquery to get its height var mmtopx =$ ("# divmmheight"). Height (); the height of mmtopx is the PX size corresponding to 1mm,The next step is to get the p
From: http://sifutian.iteye.com/blog/680935
Display Unit: pixel, dip, and SP
Dip: Device Independent pixels (device independent pixel ). different devices have different display effects, which are related to the hardware of the device. We recommend that you use this function to support WVGA, hvga, and qvga without pixels.
Px: pixels (pixels). Different devices have the same display effect. Generally, we use hvga to represent 320x480 pixels, which is
1/** 2 * switch from DP unit to PX (pixel) 3 */4 public static int dip2px (context, float dpvalue) based on the cell phone resolution) {5 Final float scale = context. getresources (). getdisplaymetrics (). density; 6 Return (INT) (dpvalue * scale + 0.5f); 7} 8 9/** 10 * based on the resolution of the phone from PX (pixel) to DP 11 */12 public static int px2dip (context, float pxvalue) {13 final float scale
Problem:Div {Background: # f00;Height: 1px;}
Purpose: I want to use Div to create a 1 px high line.
* The following ie versions are similar to IE 6.ie7 and Firefox.
At 100px and 1px, FF is normal. However, when the height attribute is smaller than 8 PX, the IE height will remain unchanged. Why do ie know 100px and do not know 1px.Solution:
========================================================== ===
Dip: Device Independent pixels (device independent pixel ). different devices have different display effects, which are related to the hardware of the device. We recommend that you use this function to support WVGA, hvga, and qvga without pixels.
Px: pixels (pixels). Different devices have the same display effect. Generally, we use hvga to represent 320x480 pixels, which is usually used.
PT: point, a standard unit of length, 1pt = 1/72 inch, used
[Css -- Form] When the font is 12 PX, the Form (radio, checkbox) is aligned with the text,
The 12 PX font alignment is only applicable to radio and checkbox.
CSS:
HTML:
It has been tested that IE, Firefox, and chrome are basically perfectly aligned. in safari, checkbox relies on a pixel, but it can be viewed as well.
Note: Setting the text line height to 1.4 (without unit) is the most ideal (the text
Dip: device independent pixels (device independent pixel ). different devices have different display effects, which are related to the hardware of the device. We recommend that you use this function to support WVGA, HVGA, and QVGA without pixels.
Px: pixels (pixels ).The display effects of different devices are the same. Generally, HVGA represents x pixels, which is usually used.Pt: pointIs a standard length unit, 1pt = 1/72 inch, used in the printing
Dip: Device Independent pixels (device independent pixel ). different devices have different display effects, which are related to the hardware of the device. We recommend that you use this function to support WVGA, hvga, and qvga without pixels.
Px: pixels (pixels). Different devices have the same display effect. Generally, we use hvga to represent 320x480 pixels, which is usually used.
PT: point, a standard unit of length, 1pt = 1/72 inch, used in t
From: http://shixin20051108.blog.163.com/blog/static/324833232010101234342417/
[Dip: Device Independent pixels (device independent pixel ). different devices have different display effects, which are related to the hardware of the device. We recommend that you use this function to support WVGA, hvga, and qvga without pixels.
Px: pixels (pixels). Different devices have the same display effect. Generally, we use hvga to represent 320x480 pixels,
How much have you heard, little friends? We used in the front-end cutting diagram project has px,em,rem,vh,% other basic useless. Especially VH, especially useful.With all the CSS units, it should be the most complete.px: absolute Unit, page by exact pixel displayem: relative units, the reference point is the size of the parent's font, if you define the font-size by itself (the browser default font is 16PX), the entire page 1em is not a fixed value.RE
DP (DIP): device independent pixels (unit independent pixels). Different devices have different display effects, this is related to the device hardware, generally we support WVGA, HVGA and QVGA recommend this, do not rely on pixels.Px:pixels (pixels). Different devices show the same effect, generally we hvga represent 320x480 pixels, this use more.Pt:point, is a standard length unit, 1pt=1/72 inches, for the printing industry, very simple to use;sp:scaled pixels (enlarge pixels). Mainly used for
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.