Setting a group to be % of viewport height dynamically

In my opinion best approach to this is to install the classify plugin and use CSS

After installing classify plugin you would add classes to the id attribute of the element you want to target

Screen Shot 2021-01-10 at 12.48.04 PM

then place an HTML element onto the page and put the styling required

Screen Shot 2021-01-10 at 12.47.53 PM

The example above is full screen

if wanted half height would do 50vh

if wanted half width would do 50vw

the benefit of this approach is that you have even more control through CSS of the elements size as you could also calculate based on other elements…an idea is I have a header of 100px at top of screen so my ‘full height element’ should be full screen height less the 100px taken up by the header.

Another benefit is that you can then start to control all elements, something I don’t believe the hero sizing with toolbox plugin allows for since that just gives 100% all the time with no granular control

Using CSS also doesn’t require a workflow action, so no timing issues to deal with. Plus you can use conditionals to change the CSS or change the Class of the element, something I’ve employed for fully responsive designs on mobile that consider the orientation of the device in real time as the device is rotated.

11 Likes