which is better using % or “viewport height.”? in sizing element in css?
This is going to depend on what you’re trying to achieve. % is going to be dependent on the parent container. If I have a div with a height of 500px and a child element of 50%, the child will have a height of 250px. However, if I were to give the child a height of 100vh, its height would be greater than its parent and overflow.
so If I have a div with 100vh and a child element of 50% that will give the child 50vh ? vh measurement will depend to whatever is the screen of the user. vh can be used for mother elements and all child can be measured by % for flexibility?
Essentially. This would allow you to create a container that always covers 100 of the view height with a child that always covers half of the view height.
so basically vh is safe when used it as measurement of mother divs.