开发者

setting height of asp:panel

I want to set the height of asp:panel to auto and开发者_如何学JAVA I also want to ensure that max height is 400px and after that scroll bars must be present. I want to set it auto so that if the content is less than height 400px there will not be any empty space in the bottom. Any ideas?? :-)


I think the CSS max-height attribute should be most appropriate to what you want:

<style type="text/css">
    .myPanelClass { max-height: 400px; overflow: auto; }
</style>
<!--[if IE 6]>
    <style type="text/css">
        .myPanelClass { height: expression( this.scrollHeight > 399 ? "400px" : "auto" ); }
    </style>
<![endif]-->

<asp:Panel runat="server" CssClass="myPanelClass">
    ....
</asp:Panel>

(EDIT: added IE6 "support")


Though I prefer Heinzi's answer in general, if you really must use IE6, perhaps just forcing the height to 400px in CSS? Haven't tried it, but it might work.

Another strategy might be to use Javascript, but you're then relying on it being present.

Whoever is forcing you to use IE6, it would also be nice for them to get with the program...

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜