开发者

css problem with height

开发者 https://www.devze.com 2023-02-05 06:01 出处:网络
I\'ve got a div that contains an unordered list that gets updated by an ajax query. It\'s used for a livesearch.

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;
0

精彩评论

暂无评论...
验证码 换一张
取 消