8  CSS Units to Make your Site Responsive

8 CSS Units to Make your Site Responsive

ยท

2 min read

Today, We live in the world of gadgets. With so many gadgets there are so many screens that too of different sizes from 4" to 13" or larger. You can find a screen of almost any size.

So to provide the contents to the consumer using any type of screen is the responsibility of a developer. This is possible only by using the proper Relative Size Units. And therefore here we will learn about those 8 Units.

1. em

It is relative to the font-size of the parent.2em means 2 times the size of the current font.

Screenshot (702).png

2. ch

It is relative to the width of the "0" (Zero).

Screenshot (703).png

3. rem

It is relative to the font size of the root element.

Screenshot (704).png

4. vw

It is relative to 1% of the width of the viewport.

Screenshot (705).png

5. vh

It is relative to 1% of the height of the viewport.

Screenshot (706).png

6. vmin

It is relative to 1% of the viewport's smaller dimension.

Screenshot (708).png

7. vmax

It is relative to 1% of viewport's larger dimension.

Screenshot (709).png

8. %

It is relative to the parent element.

Screenshot (710).png

Tip:

  • The em and rem units are practical in creating a perfectly scalable layout!
  • Viewport = the browser window size. If the viewport is 50cm wide, 1vw = 0.5cm.

That's all for this blog. If you learned from this blog Do Like it and SHARE it with your friends.

We will meet in the Next Blog Until then Keep Learning, Keep Growing.

Reference: W3Schools

Connect with me ๐Ÿ‘‡

TwitterLinkedInGmailDEV

Did you find this article valuable?

Support webtalks by becoming a sponsor. Any amount is appreciated!

ย