Skip to main content

What is the difference between visibility:hidden and display:none in CSS?



visibility:hidden

       -will only hide the content,css but not the space covered by the element.

display:none

      -will hide both the content,css and space covered by that element.

Example:

<html>
<head>
    <style>
        #id2 
        {
            visibility:hidden;
        }
        .class2 
        {
            display:none;
        }
        #id1,#id2,#id3 
        {
            background:#ea6645;
        }
        .class1,.class2,.class3 
        {
            background:green;
        }
    </style>
</head>
<body>

<div id='id1'>First div with attribute ID1</div>
<div id='id2'>Second div with attribute ID2</div>
<div id='id3'>Third div with attribute ID3</div>
<div class='class1'>First div with attribute class1</div>
<div class='class2'>Second div with attribute class2</div>
<div class='class3'>Third div with attribute class3</div>

</body>
</html>


Output:

First div with attribute ID1                                                                                                                         

Third div with attribute ID3
First div with attribute class1
Third div with attribute class3

Comments

Popular posts from this blog

Send Email(with subject,body,attachment) using SSMTP through Terminal in linux?

1.Install ssmtp as              $ sudo apt-get update && sudo apt-get install ssmtp 2.Configure smtp file by editing the following file as, $ sudo gedit /etc/ssmtp/ssmtp.conf Update file with the following: AuthUser=Sendermail@gmail.com AuthPass=SenderPasswordforGMAIL FromLineOverride=YES mailhub=smtp.gmail.com:587 UseSTARTTLS=YES Now ssmtp.conf file should look like as the following one, AuthUser=Sendermail@gmail.com AuthPass=SenderPasswordforGMAIL # # Config file for sSMTP sendmail # # The person who gets all mail for userids < 1000 # Make this empty to disable rewriting. root=postmaster # The place where the mail goes. The actual machine name is required no # MX records are consulted. Commonly mailhosts are named mail.domain.com mailhub=smtp.gmail.com:587 # Where will the mail seem to come from? #rewriteDomain= # The full hostname hostname=tele-desktop118 # A...

Updating mysql 5.5 to mysql mysql 5.7

Copy the following commands in terminal and run them: wget https://dev.mysql.com/get/mysql-apt-config_0.8.1-1_all.deb sudo dpkg -i mysql-apt-config_0.8.1-1_all.deb You'll see a prompt that asks you which MySQL product you want to configure.  The MySQL Server option, which is highlighted, should say mysql-5.7. If it doesn't, press ENTER , then scroll down to mysql-5.7 using the arrow keys, and press ENTER again,now scroll down and select OK and ENTER sudo apt-get update sudo apt-get install mysql-server sudo mysql_upgrade -u root -p  sudo service mysql restart

Mark all checkboxes based using one checkbox

< html > < body > < label >< b > Year* </ b ></ label > < input type= "checkbox" id= 'year' class= "yearcheckall" value= "0" >< b > All </ b > < input type= "checkbox" name= "year[]" class= "year" value= "1" required > 1st Year < input type= "checkbox" name= "year[]" class= "year" value= "2" required > 2nd Year < input type= "checkbox" name= "year[]" class= "year" value= "3" required > 3rd Year < input type= "checkbox" name= "year[]" class= "year" value= "4" required > 4th Year </ body > </ html > < script type = "text/javascript" src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js" ></ script > < script > $ ( ...