<textarea> padding or margins?

HTML, CSS and anything else that deals with client side capabilities.

Moderator: General Moderators

Post Reply
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

<textarea> padding or margins?

Post 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
User avatar
kaszu
Forum Regular
Posts: 749
Joined: Wed Jul 19, 2006 7:29 am

Re: <textarea> padding or margins?

Post 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 %.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: <textarea> padding or margins?

Post 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.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply