HTML | DOM Style visibility Property Last Updated : 14 Jul, 2022 Comments Improve Suggest changes Like Article Like Report The Style visibility property in HTML DOM used to set the visibility for an element. It is used to hide or show the element. It returns the visibility property that is given to an element. Syntax: It returns the visibility property.object.style.visibilityIt is used to set the visibility property. object.style.visibility = "visible | hidden | collapse | initial | inherit" Property Values: visible: It is used to specify the element to be visible. It is a default value.hidden: Element is not visible, but it affects layout.collapse: It hides the element when it is used on a table row or a cell.initial: It sets the visibility property to its default value.inherit: This property is inherited from its parent element. Return Value: It returns a string representing the content to be displayed or not for an element.Example-1: html <!DOCTYPE html> <html> <body> <center> <h1 style="color:green;"> GeeksForGeeks </h1> <h2>DOM Style visibility Property </h2> <p id="gfg"> A Computer science portal for geeks</p> <button type="button" onclick="geeks()"> Change visibility </button> <script> function geeks() { document.getElementById( "gfg").style.visibility = "hidden"; } </script> </center> </body> </html> Output: Before clicking on the button: After clicking on the button: Example-2: html <!DOCTYPE html> <html> <body> <center> <h1 style="color:green;;"> GeeksForGeeks </h1> <h2>DOM Style visibility Property </h2> <p id="gfg" style="visibility:hidden;"> A Computer science portal for geeks</p> <button type="button" onclick="geeks()"> Change visibility </button> <p id="y"></p> <script> function geeks() { var x = document.getElementById( "gfg").style.visibility; document.getElementById('y').innerHTML = x; } </script> </center> </body> </html> Output: Before clicking on the button: After clicking on the button: Supported Browsers: The browser supported by DOM Style visibility property are listed below: Google Chrome 1 and aboveEdge 12 and aboveInternet Explorer 4 and aboveFirefox 1 and aboveOpera 4 and aboveApple Safari 1 and above Comment More infoAdvertise with us bestharadhakrishna Follow Improve Article Tags : Web Technologies HTML HTML-DOM Similar Reads HTML | DOM Input Range Object The Input Range Object in HTML DOM is used to represent the HTML < input > element with type="range". This object is used to access or create the <input> element. This element can be accessed by using getElementById() method. Syntax: document.getElementById("Input_ID"); This Input_ID is 2 min read HTML | DOM Window closed Property The Window closed property in HTML DOM is used to return a value that indicates whether the referred window is closed or not. Syntax: window.close() Return Value: A Boolean value, true if window is closed otherwise false. Example: HTML <!DOCTYPE html> <html> <head> <title> HT 1 min read HTML | DOM Style textAlignLast Property The Style textAlignLast property in HTML DOM is used to set the alignment of the last line of the text. Syntax: Return the textAlignLast property: object.style.textAlignLast Set the textAlignLast property: object.style.textAlignLast = "auto | left | right | center | justify | start | end | initial | 2 min read HTML | DOM TouchEvent When a user touches a touch-based device the resulted events are handled by TouchEvent Object. The touch events consist of three types of interfaces i.e. Touch, TouchEvent and TouchList. The single contact point events on a touch-sensitive device are handled by the Touch interface. The events which 2 min read HTML | DOM Storage Event The Storage Event in HTML DOM is used to make change in the storage area in the context of another document. When there is modification in the storage area of the window, a storage event is sent to that window. Syntax: window.addEventListener("storage", script) Example: html <!DOCTYPE html> 1 min read HTML | DOM PageTransitionEvent The PageTrasitionEvent occurs during the time a document is being loaded or unloaded. Syntax: PageTransitionEvent.persisted Property Values: persisted: Returns boolean value whether the webpage was cached or not. Return Value: This property returns True if the document is loaded from a cache or not 1 min read HTML DOM Style display Property The HTML DOM Style display property is used to set or return the display type of an element. It is similar to the visibility property, which displays or hides the element. With a slight difference in display: none, hiding the entire element, while visibility: hidden meaning only the contents of the 3 min read HTML | DOM Input Submit Object The Input Submit object in HTML DOM represents the HTML <input> element with type = "submit" attribute. Syntax: It creates an Input Submit Object.document.createElement("INPUT")It is used to access an Input Submit Object.document.getElementById("id") Property Values: autofocus: It sets or retu 3 min read HTML | DOM Input URL Object The Input URL object in HTML DOM represents an <input> element with type = "url" attribute. The element with type url can be accessed by using getElementById() method. Syntax: document.getElementById("id"); where id is assigned to the <input> tag. Property Values: list: It returns the re 3 min read HTML DOM Window frames Properties The HTML DOM Window frames property in HTML DOM is used to return the frame element in the form of an array object. This property represents all <iframe> elements in the current window. DOM Windowframe is a read-only property. Syntax:window.framesProperties:length property: It returns the numb 2 min read Like