简体   繁体   English

Javascript-更改高度 <div style> 取决于div中图片的高度或将其完全删除?

[英]Javascript - Change height in <div style> depending on the height of image(s) in the div or completely remove it?

Well as the title says. 正如标题所说。 Right now each signature (on a forum) div got: 现在,每个签名(在论坛上)div都有:

<div style='height:Xpx;overflow:scroll'> (X = depends on each signature due to the image heights shifting)

And I want to change the height so I don't have to scroll through each signature, but showing all images directly. 而且我想更改高度,这样我就不必滚动每个签名,而是直接显示所有图像。 Here is the right part of a signature: 这是签名的右侧:

http://puu.sh/4xOW7.jpg (couldn't use the website-image-feature due to not having 10 rep) http://puu.sh/4xOW7.jpg (由于没有10个代表而无法使用website-image-feature)

And I tested around and managed to make it like this: 然后我进行了测试,并设法做到了:

http://puu.sh/4xPar.jpg (it's much more further down) http://puu.sh/4xPar.jpg (更深处)

and like this.. 就像这样

http://puu.sh/4xPco.jpg (couldn't post more than 2 links -_-) http://puu.sh/4xPco.jpg (最多可以发布2个链接-_-)

I also tried to remove the overflow:scroll, change it, and so on. 我还试图删除overflow:scroll,对其进行更改,等等。 (also tried removing height: etc) But I just can't get it to simply remove the scrollbar - making all images show normally. (也尝试删除高度:等),但我只是无法删除滚动条就无法使它正常显示。 I'd really appreciate help! 我非常感谢您的帮助! :) :)

instead of style="height:250px;overflow: auto;" 而不是style="height:250px;overflow: auto;"

you need style="display:inline;" 您需要style="display:inline;"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM