- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
HTML
The cols attribute of the <textarea> element is used to set the width of the textarea. The cols set it and the width is visible under the textarea itself.
Following is the syntax −
<textarea cols="num">
Above, num is the width of the textarea. The default value is 20.
Let us now see an example to implement the cols attribute of the <textarea> element −
Example
<!DOCTYPE html> <html> <body> <h2>Interview Questions</h2> <p>Why do you want go for the Editor Job Profile? (100 words)</p> <textarea rows="6" cols="70"> Write the answer in 100 words only... </textarea> <p>What are your weaknesses? (50 words)</p> <textarea rows="4" cols="70"> Write the answer in 50 words only... </textarea> </body> </html>
Output
In the above example, we have set two textarea −
<textarea rows="6" cols="70"> Write the answer in 100 words only... </textarea> <p>What are your weaknesses? (50 words)</p> <textarea rows="4" cols="70"> Write the answer in 50 words only... </textarea>
The width of the textarea is set with the cols attribute −
<textare arows="6" cols="70" autofocus>
Advertisements