Conversion Table
Centimeters | Viewport Height |
---|---|
0.1cm | 0.336vh |
0.5cm | 1.681vh |
1cm | 3.361vh |
2cm | 6.722vh |
3cm | 10.083vh |
4cm | 13.444vh |
5cm | 16.805vh |
6cm | 20.166vh |
7cm | 23.527vh |
8cm | 26.888vh |
9cm | 30.249vh |
10cm | 33.611vh |
15cm | 50.416vh |
20cm | 67.222vh |
25cm | 84.027vh |
30cm | 100.833vh |
35cm | 117.638vh |
40cm | 134.444vh |
Differences Between cm and vh
Centimeters (cm) are a metric unit of length commonly used in physical measurements. Viewport Height (vh) is a relative unit based on 1% of the viewport height in digital displays.
Advantages of Using cm
Using centimeters provides a physical measurement that can be easily converted to digital units like vh for web design and other digital applications.
How to Convert cm to vh
To convert centimeters to vh, use the following formula:
vh = cm * (96 / 2.54 / viewport height)
For example, to convert 2cm to vh with a viewport height of 1080px:
2cm * (96 / 2.54 / 1080) = 6.722vh
Frequently Asked Questions
Why should I use cm instead of vh?
Centimeters provide a physical measurement that is easy to understand and use in real-world applications. vh units are more suitable for digital displays and web design.
How do I set sizes using cm in CSS?
In CSS, you can set sizes using the cm unit, for example:
width: 10cm;
Can I mix cm and vh units?
It's possible but not recommended. Stick to one unit for consistency in your designs.