Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add a background text to textarea tags?

You know that you can add an image as a background image for textarea using :

textarea {
 background:#fff url(background.png) no-repeat center scroll; 
}

How can I have text (not image, nor text as an image) as a background for textarea ?

It isn't the text contained in the textarea itself. It is some text behind. The user can write in the textarea, and, just like the background image, see the background text behind.

CSS2 preferred, CSS3 and js are OK.

like image 406
Cedric Avatar asked Dec 02 '22 23:12

Cedric


1 Answers

How about the placeholder attribute:

<textarea rows="5" cols="30" placeholder="enter optional message"></textarea>
like image 120
Mindbreaker Avatar answered Jan 01 '23 11:01

Mindbreaker