开发者

CSS - Any way to limit element from being cut-off

I have an error box that pops up for validation errors from forms. The number of errors within the box varies so the height of the box is not static. Because the box is aligned against the bottom of the screen absolutely, if the errors exceed a certain amount (which is albeit a good bit) the box is cut off on the bottom of the screen. Does css have any kind of 开发者_高级运维property that causes height of the container to adjust vertically up instead of down or possibly limit the box to never go outside of the screen?


You can set max-height and set EDIT: overflow:auto as @ckuetbach answered.


There's no really easy way to do that without javascript, but another alternative would be using the CSS overflow property and a scroll bar.

Here's a good article about that:

http://css-tricks.com/the-css-overflow-property/

And if you're interested in the javascript, I would take a look at jQuery's height():

http://api.jquery.com/height/

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜