Get the App
SLTechnology News&Howtos  ›  Development  › 

How css uses root types

Shulou Source: shulou.com Published: 2022-06-01 05:16:26 11月17日 Update

Editor to share with you how to use the root type of css, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to understand it!

Flexible use of root types

Responding to the font size in the layout should be able to automatically adjust to the viewport, saving the work of writing media queries to handle font size. You can use: not and viewport units to calculate the font size based on the height and width of the viewport:

: root {font-size: calc (1vw + 1vh + .5vmin);}

Now you can use the root em unit, which is based on: not:

Body {font: 1rem/1.6 sans-serif;}

Combine the above rem/em techniques for better control.

The above is all the content of the article "how css uses root types". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Type unit size font article view content not much most media width layout skills more knowledge industry information information channels faceted channels Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info MariaDB vpn Apple MySQL