The difference between Display:none and Visible:hidden

Source: Internet
Author: User

Display:none and Visible:hidden can hide an element on a webpage, but there are differences:

Display:none---does not preserve its physical space for objects that are hidden, that is, the object disappears completely on the page and is not visible to the layman.

Visible:hidden---Make an object invisible on a Web page, but the space occupied by the object on the Web page does not change, and in layman's terms it is invisible but palpable.

Example:

<HTML><Head><title>The difference between Display:none and Visible:hidden</title></Head><Body><spanstyle= "display:none; hidden area </span><span style="Background-color:green ">Display area</span><BR/><spanstyle= "Visibility:hidden; hidden area </span><span style="Background-color:green ">Display area</span></Body></HTML>

Report:

In my project development, in order to sort the DTU online status in the DataTables table, a number was inserted in front of the "Green Circle" and "Gray Circle" (see) icon, as follows:

...//DTU Statusif(Itemdtu.dtustatus = =true) {sb.append (' <td><span style= "Display:none;" >0</span><i class= "icon-circle" style= "color:green; font-size:20px; " ></i></td> ');//Online}Else if(Itemdtu.dtustatus = =false) {sb.append (' <td><span style= "Display:none;" >1</span><i class= "icon-circle" style= "Color:gray; font-size:20px; " ></i></td> ');//Not in line}Else{sb.append (' <td><span style= "Display:none;" >1</span><i class= "icon-circle" style= "Color:gray; font-size:20px; " ></i></td> ');//No} ...

"Reprint" http://www.cnblogs.com/nicholas_f/archive/2009/03/27/1423207.html

The difference between Display:none and Visible:hidden

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.