Vertical scroll without setting the max-height inside a container?
Question

Hi everyone,

I'm using traditional web, OS 11.

I don't know if its possible, but I would like to be able to have a verticall scroll inside a table records, when there are too many records to fit in the computer screen. Since a laptop and a PC might have different resolutions, is there a way to have the container be the size of the screen, but when the data overflows the screen, then have a verticall scroll? just inside that container? 

So I'm trying not to fix the max-height in the container CSS. Does it makes sense?

Thanks a lot.

Ulises.

mvp_badge
MVP
Solution

Hi Ulises,


You should indeed have a max-height but you can define it with vw unit. The unit vw is relative to 1% of the height of the viewport (browser window size), see here an example.

Additionally if you need to do calculations, for instance, you want it to have the total height minus the 200 px from the header divided by 2, you can do so using the calc function. See here an example on how to use it.


Checking the examples you will quickly understand how to use them to achieve your use case.


Kind Regards,

João

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.