Home  >  Article  >  Web Front-end  >  The content of the commonly used input text box is automatically vertically centered and the default prompt text is empty when clicked.

The content of the commonly used input text box is automatically vertically centered and the default prompt text is empty when clicked.

php中世界最好的语言
php中世界最好的语言Original
2018-02-12 10:02:572887browse

This time I will bring you the content of commonly used input text boxes that are automatically vertically centered and the default prompt text is empty when clicked. What are the precautions for the content of commonly used input text boxes that are automatically vertically centered and the default prompt text is empty when clicked? The following are Let’s take a look at practical cases.

This effect has three functions:

1. The content is automatically vertically centered
2. The default prompt text is gray
3. It becomes empty after clicking

<input type="text" name="wd1" id="qy_1" maxlength="100" style="color:gray;width:199px;height:30px;line-height:30px;" autocomplete="off" value="请输入企业名称" style="color:gray;" onfocus="javascript:if(this.value == &#39;请输入企业名称&#39;) this.value = &#39;&#39;; this.style.color=&#39;gray&#39;;" onblur="if(this.value == &#39;&#39;) {this.value = &#39;请输入企业名称&#39;; this.style.color = &#39;gray&#39;;}">

I believe you have mastered the methods after reading these cases. For more exciting information, please pay attention to other related articles on the php Chinese website!

Related reading:

What are the differences between inline elements and block-level elements in html

How to use trigger method to achieve There is no need to click on the file type input to pop up the file selection dialog box

What are the symbols that mark text comments in Html

The above is the detailed content of The content of the commonly used input text box is automatically vertically centered and the default prompt text is empty when clicked.. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn