如何在溢出时更改div样式 [英] How to change div style on overflow
本文介绍了如何在溢出时更改div样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当此DIV中的内容溢出时,我希望更改DIV样式.有人可以帮我吗?
任何帮助表示赞赏.
问候,
Sunny_K
Hi,
I want the DIV style to be changed when the contents within this DIV overflow... I have no Idea about doing this. Can anybody please help me how can I?
Any help is appreciated.
Regards,
Sunny_K
推荐答案
var element = document.getElementById("div1");
if(element.scrollWidth > element.clientWidth)
element.style.borderStyle="solid"; //whatever change you want to make
仅在元素设置为显示时才起作用:block
only works when the element is set to display:block
这篇关于如何在溢出时更改div样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文