I am making a dynamic vertical sidebar which uses PHP to fetch data from the database.
However, as it is dynamic I have to make sure it will work properly even if it has 100 lines of text.

But I am facing a problem that it is going below the page when it has nearly 100 lines of text instead of stretching the page along with it. The main reason for this is: I am using float in css to move it at the right side of the page. Is is good to use absolute or relative position instead of making it float in case of a dynamic sidebar? Or do you have any better idea than this?


6 Years
Discussion Span
Last Post by Zagga

I get it but what if there are too many headers? I want something that will stretch the div along with it.


I use CSS but what code I need to use to make it stretch itself along with the div?


My sidemenu which is inside a div, when too long stretches itself but it goes outside the div instead of stretching the div because it uses 'float: right' css property. What to do to make it stretch the div if it's too long(about 100 lines of text)?


What to do to make it stretch the div if it's too long(about 100 lines of text)?

If I understand well your question, then you would use same css proerty you used with element itself


Hi Nahiyan,

This is a CSS question, not PHP.

The div that contains your menu should expand to fit its content unless it has a fixed height. You could use the 'overflow' property to create scroll bars if the content is too long for a fixed height div but I personally think they look terrible.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.