Hello,

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?

Thanks,
Nahiyan

may be screenshot will help explaining what you are saying. I have not understood what you have just said!

Ok, so here is the screenshot

I don't think there is PHP solution as issue is HTML. I would suggest you use Javascript to just show heading and one drop list per click(accordion). I know my explanation are unclear but check this JQuery UI element to get picture:
http://jqueryui.com/themeroller/#themeGallery

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?

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

What do you mean?

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

Member Avatar for Zagga

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.