Reputation: 2485
I have a div
called main
which is 100% width
of his parent width.
In #main
I have input
field and textarea
.
I can expand input
field (width:100%) but how to do the same with textarea
?
Upvotes: 0
Views: 3614
Reputation: 1556
As per my undestanding u can mention number of rows and columns in the textarea i.e.
<textarea name="foo" rows="10" cols="10"></textarea>
or using CSS u can specify a class to it and then mention the style's u want in ur textarea.
In ur HTML file write this:
<textarea class="foo"></textarea>
and in ur CSS file write this:
foo{
width : 100%; or 100px;
bockground-color : red; #its upto ur wish.
}
You can use either of the two ways
Upvotes: 0
Reputation: 6572
I think you try to do it by using the attribute "width". You can do it quite easy by using css. Here's an example:
<div id="main">
<input name="test" style="width: 100%;"><br/>
<textarea name="bla" style="width: 100%;"></textarea>
</div>
Upvotes: 0
Reputation: 12469
Do not use the width attribute. Use css instead. You can put the style in a separate css file:
input, textarea { width: 100%; }
or you can put the style inline in the elements:
<input type="text" style="width: 100%" />
<textarea style="width: 100%"></textarea>
I recommend the first option because it allows you to separate the style of the page.
Upvotes: 2
Reputation: 2751
This will solve it
<div style='width:100%'>
<input type="text" style='width:100%' />
<textarea style='width:100%'>Text Area!</textarea>
</div>
Upvotes: 2