I've got a div that contains an unordered list that gets updated by an ajax query. It's used for a livesearch.
Now I have this problem that when I set the height of the div to a fixed height (let's say 200) that the results ar开发者_Python百科e shown as they should. But when I don't set the height, or set it to auto, the div has a height of 0 when the searchresults are added to the ul.
I think this has something to do with the ajaxquery and the browser not recognizing the new height, but I don't know how to set it the right way.
How can I fix this?
Thanks in advance,
Try adding some dummy content statically on the html page and see if the height is still 0. If it is then you have a CSS issue. Most probably the contents of the div (list) are absolute positioned so the parent div cannot know the list's height.
You can try adding adding a min-height to the div containing the ul.
min-height: whatever-you-want-minimum-height;
精彩评论