Μετάβαση στο κύριο περιεχόμενο
← 📄 HTML & the platform·Ενότητα A3 · Μάθημα 7
ΕργασίαBuild a feedback form: <label for='msg'>Message</label> + <textarea id='msg' name='message' rows='5' maxlength='1000' placeholder='Tell us'></textarea>.

<textarea>: κείμενο πολλών γραμμών

60 XP5 min
Θεωρία

The two attributes worth knowing

<textarea name="bio" rows="4" cols="40" placeholder="Tell us about yourself" maxlength="500"></textarea>
  • rows — visible lines (height hint). Browser still allows scrolling beyond.
  • cols — visible columns (width hint). Most modern designs override with CSS width: 100% instead.
  • maxlength — hard cap on characters, same as <input>.
  • placeholder — gray hint shown when empty.

NOT self-closing

<textarea /> doesn't work the way <input /> does. <textarea> must have an opening and closing tag — and the initial value goes between them:

<textarea name="message">Default text here</textarea>

White space matters — leading/trailing newlines inside the tag are included in the value.

Resize via CSS, not HTML

textarea { resize: vertical; }   /* allow vertical drag only */
textarea { resize: none; }       /* disable drag handle */

resize: both is the browser default. Disable horizontal resize on narrow layouts to prevent users from breaking your design.

🔒

Εγγράψου για να αρχίσεις να προγραμματίζεις

Η θεωρία είναι ανοιχτή για όλους. Ο επεξεργαστής, η ζωντανή προεπισκόπηση και ο έλεγχος ξεκλειδώνουν με 7-ήμερη δωρεάν δοκιμή — απαιτείται κάρτα.

Εγγραφή — δωρεάν δοκιμή →

Τα πρώτα 10 μαθήματα κάθε διαδρομής είναι δωρεάν. Δεν χρειάζεται κάρτα.

← ΠροηγούμενοΕπόμενο μάθημα →

Μια συμβουλή Python ή web την ημέρα — με email

Σύντομο, γραμμένο στο χέρι, χωρίς spam. Διαγραφή με ένα κλικ.