Page 1 of 1

<textarea> padding or margins?

Posted: Fri Jan 30, 2009 4:38 pm
by alex.barylski
I am trying to add some padding inside the <textarea> however no matter which I use (margin | padding) the scrollbars are pushed off screen by equal amounts.

What is the CSS trick to accomplish this, so that the text is not flush against the sides of the control?

I cannot embed the textarea inside a DIV so this all needs to be done within the styles of the textarea control itself.

p.s-The width is set to 100% so I'm not sure if that changes things.

Cheers,
Alex

Re: <textarea> padding or margins?

Posted: Sun Feb 01, 2009 8:42 am
by kaszu
Actual width of the textarea is width (100% of available width in your case) + border + padding + margin.
Possible solution is to set width to px or smaller %.

Re: <textarea> padding or margins?

Posted: Mon Feb 02, 2009 11:09 am
by pickle
Does the width of the textarea change? You said it's set to 100%, but does it's container or one of it's parent have dynamic width? If not, set the width to a few less pixels, and add some padding. If the width of the textarea is dynamic, I think you're screwed.