Wednesday, July 17, 2013

Working with Html textarea

Working with Html textarea

skill level Beginer

To create a default textarea in your webpage use the following code:


<textarea></textarea>

The text area will look like this:
example 1


To make your textarea a particular size use this code:

<textarea rows="5" cols="40"></textarea>

example 2

To center a text area use this code:

<div align="center">
<textarea></textarea>
</div>

As you can see above, we have made a <div></div> tag, meaning that everything between those two tags will be centered when we add align="center" to the opening tag. Here is another code example that explains what i mean.

<div align="center">
<textarea></textarea>
<p>I am centered as well</p>
</div>
example 3

I am in centered as well

Setting the background color for your textarea

As you can see, the textareas examples all have light gray background colors so they show up better on the page. By default, the textareas will be white. However, to set the background color of your text areas you will use the sytle property. Here's how to do it.

<textarea style=background-color:lightgray></textarea>

The resulting textbox using the above html code will look exactly like example 1.

Putting a border around your texarea

<textarea style="background-color:lightgray;border:5px solid green;"></textarea>



Changing the text color

Changing the text, or font color, is similar to changing the background color but easier. To change the text color, simply use this code: color:blue; 






No comments:

Post a Comment