homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

Textarea scrollbar doesn't disappear despite width:0

5+ Year Member

Msg#: 4665992 posted 2:09 am on Apr 26, 2014 (gmt 0)

No scrollbar in Chrome, but in Firefox and IE, it doesn't disappear although the element width is 0:
DEMO: [jsfiddle.net ]

What's the reason? What's a cross-browser solution so the textarea behaves like in Chrome?



WebmasterWorld Senior Member 10+ Year Member

Msg#: 4665992 posted 3:14 pm on Apr 26, 2014 (gmt 0)

overflow:hidden seems to work, but it feels wrong. You'll almost certainly have to restore overflow:scroll when you want the box to be available to the user. I'd be more inclined to use the visibility property to toggle the element in and out.


WebmasterWorld Administrator 5+ Year Member Top Contributors Of The Month

Msg#: 4665992 posted 3:46 pm on Apr 26, 2014 (gmt 0)

I looked at it yesterday but didn't post because I am not js/Ajax fluent, don't use a Chrome browser to check against.

..but in simple terms of css, the scrollbar comes from assigning a height of 200px to the textarea element. A width:0 wouldn't change that. If you remove the height attribute from the textarea css, the scrollbar disappears in FF. If you need that height for positioning, you might try to contain the form to a div with the 200px height setting.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved