Click to See Complete Forum and Search --> : Is it possible to put an image in a textarea box?


KingCobra220
08-09-2005, 05:08 PM
Yes or No?

If yes...

Could you explain how. I've been searching all day and all I find is background images in textareas. This will be used for an image map so it doesn't widen the page. Thanks for the help, if any!

Charles
08-09-2005, 05:13 PM
<!ELEMENT TEXTAREA - - (#PCDATA) -- multi-line text field -->Which is to say that the TEXTAREA element can only contain parsed character data, no elements. To do what you want simply use a DIV and CSS.

Ultimater
08-09-2005, 06:06 PM
To do what you want simply use a DIV and CSS.
CSS is easier. The trick is to give the textarea's text a margin and give the textarea a background which is attached with no margin. Same can be done with the INPUT TYPE="TEXT". You could also use layers and stack 'em as you like which Charles also points out.

Ultimater
08-09-2005, 06:21 PM
Oh, sorry. I meant padding not margin.
Here's a simple example:

<style type="text/css">
.wd{
background: url(http://webdeveloper.com/favicon.ico) no-repeat;
padding-left:20px;
}
</style>
<input type="text" class="wd">

KingCobra220
08-09-2005, 08:44 PM
Oh, sorry. I meant padding not margin.
Here's a simple example:

<style type="text/css">
.wd{
background: url(http://webdeveloper.com/favicon.ico) no-repeat;
padding-left:20px;
}
</style>
<input type="text" class="wd">


That does the trick.