2

Hi have the code where i whrite the code inside the Text area to get the format like below.But my problem is the text is format correctly and how i can place the same text format inside the textarea.

<input type="textarea">
<P align = center>
<B>About Salman Khan </B>
</P>
<P align = left>Salman Khan (pronunciation  born Abdul Rashid Salim Salman Khan on 27 December 1965)[5] is an INDIAN film actor and producer. He is cited in the media as one of the most commercially successful actors of Hindi cinema.
</P>
<P>
<ul>
 <li>Undertake our tasks and activities in utmost good faith, objectivity, transparency, competence, due care and professionalism.</li>
<li>Abide by the highest standards of politeness and good conduct.</li>
</ul>
</P>
</input>

1 Answers1

2

Sorry, you can't style a textarea. However it does seem like there are some workarounds available. Here's the first thing I found:

Format text in a <textarea>?

So basically you put all your content in a div and style it to make it work like a text area. Here you can see I've made it scrollable, made it editable, plus setting the height/width and borders. (There don't need to be set, depending on exactly what you want.) I think the biggest problem here is that different browsers style text areas differently so there probably is no really easy to way style it so it looks exactly like a native textarea in all browsers.

<div id='fake_textarea' style="overflow:scroll; height:100px; width:400px; border:solid; border-width:1px" contenteditable>
    <P align=center>
         <B>About Salman Khan </B>
    </P>
    <P align=left>
        Salman Khan (pronunciation  born Abdul Rashid Salim Salman Khan on 27 December 1965)[5] is an     INDIAN film actor and producer. He is cited in the media as one of the most commercially successful actors of Hindi cinema.
    </P>
    <P>
        <ul>
            <li>Undertake our tasks and activities in utmost good faith, objectivity, transparency, competence, due care and professionalism.</li>
            <li>Abide by the highest standards of politeness and good conduct.</li>
        </ul>
    </P>
</div>

Notice that this the same as your code, except I replaced the input tag with a styled div.

See the posts in the above answer if you need to be use this field in a form and must submit the contents. It takes a minor work around.

Community
  • 1
  • 1
Visser
  • 188
  • 1
  • 10
  • i am not getting your point .can u show me the demo .how i can do that. –  May 14 '15 at 08:35