DIV宽度和高度在设置innerHTML时不会调整大小? [英] DIV width and height wont resize when setting innerHTML?

查看:467
本文介绍了DIV宽度和高度在设置innerHTML时不会调整大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我将图像设置为DIV容器的innerHTML时,DIV的宽度和高度仍未更改。 div有 border:solid 样式,边框就像图片的外部一样... ...

图像显示完整,但它伸展在div边界之外,但仍然显示。这是一个问题吗?



我应该使用DOM方法吗?



谢谢

解决方案

您是否设置了div的溢出 css属性?

http://www.w3schools.com/Css/pr_pos_overflow.asp


When I set an image to the innerHTML of a DIV container, the width and height of the DIV is still not changed. The div has border:solid style and the border is like "outside" the image...

So the image is shown fully, but it streches outside the div borders, but still shows anyway. Is this a problem ?

Should I use the DOM method instead, will it be better ?

Thanks

解决方案

have you set the overflow css property of your div ?

http://www.w3schools.com/Css/pr_pos_overflow.asp

这篇关于DIV宽度和高度在设置innerHTML时不会调整大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆