Saurav Srivastava Saurav Srivastava - 6 days ago 5
CSS Question

Getting different output on Chrome and Firefox when setting height in percentage

I'm giving height in %. It gives output as expected on Chrome but not on Firefox.
I'm new in front-end development. Any help will be appreciated. Thanks in advance.

Answer

Hi @Saurav the height in percentage does not work properly every time. It will work fine if your parent have fix height (either in px, pt, view port unit).

Its better to use view port for height. If you are not aware of it, read the following article.

https://www.w3schools.com/cssref/css_units.asp

https://css-tricks.com/viewport-sized-typography/