简体   繁体   中英

How to change textarea size on html?

I need to set my textarea size to 64%, but I can't. Can you help me to do this. Thanks for your help :)

<!DOCTYPE html>
<html>
<body>
<style>
div.c18 {position: absolute;width:64%;left:18%}
div.c7 {position:relative;overflow:hidden;left:18%;}
</style>


<div class="c7">OTHER</div>
<div class="c18">
<input type="textarea">
</div>
</br>

</body>
</html>

You need to add how many rows and columns you want.

You can do like this:

 <textarea rows="10" cols="80"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam non augue nec risus lobortis pulvinar. Mauris imperdiet orci vitae commodo condimentum. Nam molestie risus iaculis enim dictum egestas. Vivamus commodo mauris consectetur diam fringilla, ut tempor nulla volutpat. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla feugiat fringilla turpis in feugiat. In hac habitasse platea dictumst. Aenean laoreet orci et varius fermentum. </textarea> 

Set the width of the child <input> or <textarea> to 100% so it fills the parent that is 64%

<input type="text" style="width:100%">

This can obviously be changed to a stylesheet rule

DEMO

Instead of giving width to the container, give a specific width to the textarea . Like:

CSS

#area { width: 50%; }

HTML

<textarea id="area">
</textarea>

First of all the textarea shall be used by textarea html tag And to give height and width to textarea "rows" and "cols" property will be used. Please refer below code.

<textarea rows="10" cols="80"></textarea>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM