Home > Web Front-end > HTML Tutorial > How to hide input in html

How to hide input in html

青灯夜游
Release: 2021-05-27 17:13:48
Original
16158 people have browsed it

Hide method: 1. Set the value of the type attribute of the input tag to "hidden"; 2. Use the style attribute of the input tag to add the "display:none" style; 3. Use the style attribute of the input tag to add "visibility:hidden" style.

How to hide input in html

The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.

Method 1:

<input  type = "hidden" />
Copy after login

The type attribute specifies the type of input element; when the value is hidden, a hidden input field can be defined.

Method 2:

<input  type = "text"  style = "display:none"  />
Copy after login

The style attribute specifies the inline style of the element

display:none method, does not occupy space, Hide the element, so dynamically changing this attribute will cause rearrangement (change the page layout), which can be understood as deleting the element from the page; it will not be inherited by descendants, but its descendants will not be displayed. After all, All hidden together.

Method 3:

<input  type = "text"  style = "visibility:hidden"  />
Copy after login

The visibility attribute specifies whether the element is visible. This property specifies whether to display the element box generated by an element. This means that the element still occupies its original space, but can be completely invisible.

visibility:hiddenIn the method, the element will be hidden, but it will not disappear and still occupy space. After hiding, the original HTML style will not be changed; it will be inherited by descendants, and descendants can also Anti-hide by setting visibility: visible;; events bound to the element will not be triggered. Dynamically modifying this property will cause redrawing.

For more programming related knowledge, please visit: Programming Video! !

The above is the detailed content of How to hide input in html. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template