Deane
Deane

Reputation: 8773

Is it possible to make a textbox look and act like a textarea through CSS alone?

Is it possible to get a textbox ("input" with "type=text") to act like a textarea through CSS alone?

I can set the height and width, obviously, but I can't get it to wrap like a text area nor vertically align the contents like one.

I have a situation where I can't change the HTML of the page, but I can alter the CSS. My users want textareas where they just have textboxes, and I'm hoping I can pull it off with CSS alone.

I've tried about every combination of "white-space" and "vertical-align."

Upvotes: 2

Views: 3754

Answers (1)

Roloc
Roloc

Reputation: 1930

No. You would need some JavaScript as well to change the browser functions. For instance when you hit the enter key in a textbox it submits the form, where as in a text area it will add a new line.

Things like that can't be controlled by CSS to my knowledge.

Upvotes: 7

Related Questions