Get the App
SLTechnology News&Howtos  ›  Development  › 

What is the difference between different units in CSS

Shulou Source: shulou.com Published: 2022-06-01 05:45:16 10月03日 Update

This article mainly introduces what is the difference between different units in CSS, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, let the editor take you to understand it.

Different units in CSS

1.px

Px (Pixel, pixel), a unit of relative length, is relative to the screen resolution of the display.

There is nothing special about px. You can display as many px as you set px.

2.em

Em is different from px in that its value is not fixed, and the value it sets is different in different cases.

3.rem

Rem is similar to em, except that rem is only relative to the font size of the root element (html) and is generally used for mobile adaptation.

4.vw and vh

Vw and vh are the width and height of the reference viewport, respectively.

Thank you for reading this article carefully. I hope the article "what is the difference between different units in CSS" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Tags: Different unit article reference value pixel element interest resolution at the same time place size font width screen situation monitor more friends knowledge Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Redmi Xiaomi Linux Shulou Tech Info