raimond raimond - 1 month ago 6
CSS Question

How to change height of an element as screen size gets smaller?

I am stumped on this issue. I have a feeling the solution is rather simple, but I can't figure it out myself.

Currently the background of one section doesn't increase its height to accommodate all the text that gets pushed down due to lower screen size. How do I make it so the background of 1 section increases together with the text.

I have made a gif of the action: https://i.gyazo.com/fb3a0ad686f28dfbb0f016810f3e9d0e.gif

And some relevant code:
http://www.bootply.com/wXC2JnWXbT

Thanks for any help.

Answer

Have you tried height:auto and setting a min-height along with it? Or add padding to the bottom so that you can have that initial gap still-- But that would make the text always have that padding, which I don't know that you want, so I wouldn't advise it.

Alternatively, set overflow:auto so that a scrollbar will appear when the text goes beyond its box. Then there's no need for height change

Comments