Html element to show and hide

 

An html element hiding syntax

< Span style = "Run the display: none" > At this point I see you see you </ span >

 

visibility: hidden and display: none differ in effect, impact on the HTML element definition :

1, different roles

visibility: hidden ---- The element hiding, but the page in the occupied position or occupied.

display: none ---- the display element is set free, that does not account for any location in the page.

2, the use of HTML elements differ

visibility: hidden, the use of the attribute, HTML elements (objects) only is invisible (fully transparent), and it occupies a spatial position still exists, which is to say still has the property value of the height, width and the like.

display: none, the use of the attribute, HTML elements (objects) various properties of width, height, etc. will be "lost."

3, different definitions

visibility attribute specifies whether an element is visible.

The display attribute is used to define the type of display frame generated when creating the layout element.

 

Use JavaScript to hide an element

document.getElementById('elementId').style.display = "none";

 

Guess you like

Origin www.cnblogs.com/jkfeng/p/11995846.html