What justification does multi-line placeholders not allow in HTML5?

I create a very simple form with a text area. The text area accepts a formatted block of names separated by newlines. It would be nice to make the application a little more useful if I could include an example placeholder with a few lines of text. Unfortunately, this is not possible in the HTML5 specification. Does anyone know why?

+4
source share
1 answer

<placeholder> is like <placeholder> to me. It has a certain niche.

In the case of the <placeholder> attribute, it is mainly used in single-line forms; not text areas.

How often do you use carriage returns in a single line field? Never.

The <placeholder> attribute represents a short hint (a word or short phrase) intended to aid the user with data entry. A hint could be a sample value or a brief description of the expected format. The attribute, if specified, must have a value that contains no U+000A LINE FEED (LF) or U+000D CARRIAGE RETURN (CR) characters.

Since HTML5 is still fresh, new and continues to be optimized and customized in different browsers; who knows what crazy things will happen in the browser if the <placeholder> attribute has not set such strict rules?

The network seems to be moving in a direction that helps designers / developers to inject less code and make less mistakes.

I saw several posts (such as Paul Irish and Jeffrey Way) on how to skip things like closing tags, and many standard elements have been changed in HTML5 to be shorter / easier (e.g. <!doctype html> ). In addition, what used to be traditional attributes necessary for a web page to work effectively can now be thrown away together. The network is becoming easier and more complex at the same time.

In general, although if you want to fix the dilemma (which you seem to suffer from the tone of your question), then just use the <title> attribute. Refer to the selected answer in the question located at the following link:

Can you have multi-line HTML5 placeholder text in <textarea>?

+2
source

Source: https://habr.com/ru/post/1385663/


All Articles