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

How to hide controls in html

藏色散人
藏色散人Original
2021-05-12 11:27:224655browse

How to hide the html control: 1. Hide through "getElementById("typediv1").style.visibility="hidden";"; 2. Hide through "style.display="none";" .

How to hide controls in html

The operating environment of this article: Windows7 system, HTML5&&CSS3 version, Dell G3 computer.

HTML control hiding

The visibility of the div can control the display and hiding of the div, but the page appears blank after hiding:

  style="visibility: none;"
  document.getElementById("typediv1").style.visibility="hidden";//隐藏
  document.getElementById("typediv1").style.visibility="visible";//显示

By setting the display attribute You can hide the div and release the occupied page space, as follows

  style="display: none;"
  document.getElementById("typediv1").style.display="none";//隐藏
  document.getElementById("typediv1").style.display="";//显示

Recommended learning: "html video tutorial"

The above is the detailed content of How to hide controls in html. 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