views:

30

answers:

3

hi expert, i'm retrieving data from database and display it inside textarea in table format, i try to apply css styling for table inside textarea but no effect, does any one know or done this before, please advice, i'm using javascript editor to the display more like word so user can format the document,

<style type="text/css"> 
 table {  } 
 td,th { white-space:nowrap; padding:3px;color: red; } 
 .test { 
 font-family: Arial, Helvetica, sans-serif;
 font-size: 16px;
 color: red; }
 </style>

 <table width="120%" border="0" cellpadding="0" cellspacing="1">
  <tr>
   <td width=100% valign="top" class="test">Test
    <textarea name="txt_letter_body" style="width=100%" rows="50" >         <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr valign=top>
       <td  class="test">Data</td>
       <td align=left colspan=3><font face="Arial, Helvetica, sans-serif" size=3  ></font></td>
      </tr>
      <tr valign=top>
       <td></td>
       <td colspan=3><hr noshade size=1 color=#000000></td>
      </tr>
     </table>
    </textarea> 
   </td>
  </tr>
 </table>

is it any possible to apply css for table inside textarea,

thanks in advance

+2  A: 

Most implementations of what you're asking for are somewhat complex. You're basically asking for a WYSIWYG editor if you want styling.

An example would be the comment box like the one on StackOverflow that shows a formatted version below. Another example is TinyMCE that uses a hidden textarea to store the actual text but displays the formatted version in separate markup.

Look at http://tinymce.moxiecode.com/

nopuck4you
A: 

The contexts of a can only be Plain text (including entities). So another approach, in previously indicated, is called for to format the text.

Don
A: 

finally i found 1 solution, i just add style attributes into table after textarea, which as below

<table width="100%" border="0" style="font-family: arial;">
Apache