HTML px, em, pt length units

(*-*)浩
Release: 2019-10-14 16:11:15
Original
3032 people have browsed it

HTML px, em, pt length units

The px unit name is pixel, a relative length unit. Pixel (px) is relative to the monitor screen resolution;

em unit name is a relative length unit . Relative to the font size of the text in the current object, it is used more abroad; (Recommended learning: html tutorial)

The pt unit name is point (Point), and the absolute length unit is generally used in older versions. Tables use length size units, but they are basically not used now.

htmlShort introduction to units:

Px Pixel; relative length unit.

Pt Point; absolute length unit

Em relative length unit, where em is spelled exactly the same as the "EM" of the html tag, and here em is used as a separate text unit .

1. In the past, IE could not adjust the font size that used px as the unit, but now almost IE supports it and it is recommended to use px as the unit;

2. Most foreign websites can The reason for the adjustment is that it uses em as the font unit;

3. Firefox can adjust px and em, but more than 96% of Chinese netizens use IE browser (or kernel).

px pixels (Pixel). Relative length unit. Pixel px is relative to the monitor screen resolution, and QQ screenshots also use PX as the length and width unit.

em is a relative unit of length. The font size relative to the text within the current object. If the current font size for inline text has not been manually set, it will be relative to the browser's default font size.

Set different lengths for text em px pt units to see the effect:

CSS code:

.divcss-px{ font-size:12px} 
.divcss-pt{ font-size:12pt} 
.divcss-em{ font-size:2em}
Copy after login

HTML code:

我是divcss1
我是divcss2
我是divcss3
Copy after login

The above is the detailed content of HTML px, em, pt length units. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact [email protected]
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!