jquery - Setting the height of an absolutely positioned div to the height of its contents -
ok, feel question has been asked before here, after hour of searching google cannot find solution this.
i have div styled this:
position: absolute; height: 100px;
and when contents of div changes, want set height of div height of contents of div. using jquery.
how can done?
you can use:
min-height: 100px;
reference: https://developer.mozilla.org/en-us/docs/web/css/min-height
if whatever reason can't use that, or want else, can height of content of element, regardless of height of actual element, using scrollheight
property of html element:
https://developer.mozilla.org/en-us/docs/web/api/element.scrollheight
in jquery:
$(...).prop('scrollheight')
Comments
Post a Comment