How do I make the scrollbar on a div only visible when necessary?

I have this div: <div style=”overflow:scroll; width:400px;height:400px;”>here is some text</div> The scrollbars are always visible, even though the text does not overflow. I want to make the scrollbars only be visible when necessary – that is, only visible when there is enough text in the box that they are needed. Like a textarea does. How … Read more

How can I check if a scrollbar is visible?

Is it possible to check the overflow:auto of a div? For example: HTML <div id=”my_div” style=”width: 100px; height:100px; overflow:auto;” class=”my_class”> * content </div> JQUERY $(‘.my_class’).live(‘hover’, function (event) { if (event.type == ‘mouseenter’) { if( … if scrollbar visible ? … ) { alert(‘true’): } else { alert(‘false’): } } }); Sometimes is the content short … Read more

Custom CSS Scrollbar for Firefox

I want to customize a scrollbar with CSS. I use this WebKit CSS code, which works well for Safari and Chrome: ::-webkit-scrollbar { width: 15px; height: 15px; } ::-webkit-scrollbar-track-piece { background-color: #c2d2e4; } ::-webkit-scrollbar-thumb:vertical { height: 30px; background-color: #0a4c95; } How can I do the same thing in Firefox? I know I can easily do … Read more

Make iframe automatically adjust height according to the contents without using scrollbar? [duplicate]

This question already has answers here: Adjust width and height of iframe to fit with content in it (34 answers) Closed 5 years ago. For example: <iframe name=”Stack” src=”” width=”740″ frameborder=”0″ scrolling=”no” id=”iframe”> … </iframe> I want it to be able to adjust its height according to the contents inside it, without using scroll. 17 … Read more