What are the main units of CSS absolute length? How to convert between absolute length units?

青灯夜游
Release: 2018-10-17 17:14:06
Original
7279 people have browsed it

This article will introduce to you what are the main absolute length units in CSS length units and how to convert them. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

There are many length units in CSS, which can be described as diverse, but they can basically be divided into three categories: relative length units, absolute length units and visual area percentage length units. The absolute length units represent: length units that are fixed to each other and will not change due to changes in the size of other elements, mainly including: px, pc, pt, in, mm, cm.

First of all, let’s briefly introduce these units of length.

css px unit---the most commonly used length unit

px is also known as: pixel, which is the screen media (that is, read on the computer screen Take) a unit of fixed size, which is a unit measured in angle. One pixel is equal to one point on the computer screen (ie: the smallest division of the screen resolution), and web pages can be perfectly rendered precisely per pixel. Let’s take a look at how to set it up, for example:

.demo{  font-size: 40px; }
Copy after login

What are the main units of CSS absolute length? How to convert between absolute length units?

css pc unit

pc: pica( Pica), which is equivalent to the size of my country's new No. 4 type.

.demo{  font-size: 4pc; }
Copy after login

What are the main units of CSS absolute length? How to convert between absolute length units?

css pt unit

pt: Point, absolute length unit

.demo{  font-size: 40pt; }
Copy after login

What are the main units of CSS absolute length? How to convert between absolute length units?

css inunit

in: Inch, a physical unit of measurement, but in the CSS world , inches are simply mapped directly to pixels.

.demo{  font-size: 0.5in; }
Copy after login

What are the main units of CSS absolute length? How to convert between absolute length units?

css mm unit

mm: Millimeter (Millimeter), which is a small order of magnitude physical unit of measurement.

.demo{  font-size: 10mm; }
Copy after login

What are the main units of CSS absolute length? How to convert between absolute length units?

css cm unit

cm: Centimeter, for most people in the world For people, it is a relatively familiar and useful unit of physical measurement. In css it is also mapped to pixels.

.demo{  font-size: 1cm; }
Copy after login

What are the main units of CSS absolute length? How to convert between absolute length units?

Then, let’s take a look at how these length units are converted:

1in = 2.54cm = 25.4 mm = 72pt = 6pc =96px

Below we give the formula for the mutual conversion of pt and px:

px = pt * (96/72)

pt=px* (72/96 )

Summary: The above is the entire content of this article, I hope it will be helpful to everyone's study. For more related tutorials, please visit CSS Basics Video Tutorial, CSS3 Video Tutorial, bootstrap Video Tutorial!

The above is the detailed content of What are the main units of CSS absolute length? How to convert between absolute length units?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
px
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 admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template