Suppose there is a div block with styles:

div { position: absolute; background-color: grey; width: 30%; height: ???; margin-left: 35% 

How to make, that height made, for example: 200% of width or 50% of width?

  • If we are talking about the width of the screen - vw habrahabr.ru/post/126863 - Andy
  • Please specify what it means "200% width or 50% width" ? Interest on what? - Vadim Ovchinnikov

1 answer 1

If under the word "width" you mean the width of the screen, then you need to use the unit of measurement vw . For example, 100vw is equal to the width of the browser window.

 div { height: 200vw; }