علامة <textarea> HTML


مثال

عنصر تحكم إدخال نص متعدد الأسطر (منطقة نص):

<label for="w3review">Review of W3Schools:</label>

<textarea id="w3review" name="w3review" rows="4" cols="50">
At w3schools.com you will learn how to make a website. They offer free tutorials in all web development technologies.
</textarea>

المزيد من الأمثلة "جربها بنفسك" أدناه.


التعريف والاستخدام

تحدد العلامة <textarea>عنصر تحكم إدخال نص متعدد الأسطر.

غالبًا ما يستخدم <textarea>العنصر في نموذج لتجميع مدخلات المستخدم مثل التعليقات أو المراجعات.

يمكن أن تحتوي منطقة النص على عدد غير محدود من الأحرف ، ويتم عرض النص بخط ثابت العرض (عادةً ما يكون Courier).

يتم تحديد حجم منطقة النص بواسطة السمات <cols>و (أو باستخدام CSS).<rows>

السمة nameمطلوبة للإشارة إلى بيانات النموذج بعد إرسال النموذج (إذا حذفت nameالسمة ، فلن يتم إرسال أي بيانات من منطقة النص).

السمة idمطلوبة لإقران منطقة النص بالتسمية. 

نصيحة: أضف دائمًا علامة <label> للتمتع بأفضل ممارسات إمكانية الوصول!


دعم المتصفح

Element
<textarea> Yes Yes Yes Yes Yes


صفات

Attribute Value Description
autofocus autofocus Specifies that a text area should automatically get focus when the page loads
cols number Specifies the visible width of a text area
dirname textareaname.dir Specifies that the text direction of the textarea will be submitted
disabled disabled Specifies that a text area should be disabled
form form_id Specifies which form the text area belongs to
maxlength number Specifies the maximum number of characters allowed in the text area
name text Specifies a name for a text area
placeholder text Specifies a short hint that describes the expected value of a text area
readonly readonly Specifies that a text area should be read-only
required required Specifies that a text area is required/must be filled out
rows number Specifies the visible number of lines in a text area
wrap hard
soft
Specifies how the text in a text area is to be wrapped when submitted in a form

السمات العالمية

تدعم <textarea>العلامة أيضًا السمات العامة في HTML .


سمات الحدث

تدعم <textarea>العلامة أيضًا سمات الحدث في HTML .


مزيد من الأمثلة

مثال

تعطيل خيار تغيير الحجم الافتراضي:

<html>
<head>
<style>
textarea {
  resize: none;
}
</style>
</head>
<body>

<label for="w3review">Review of W3Schools:</label>

<textarea id="w3review" name="w3review" rows="4" cols="50">
At w3schools.com you will learn how to make a website. They offer free tutorials in all web development technologies.
</textarea>

</body>
</html>

الصفحات ذات الصلة

مرجع DOM HTML: كائن Textarea

دروس CSS: نماذج التصميم


إعدادات CSS الافتراضية

لا أحد.