Sunday 5 April 2015

How to open and close div using css



Hello! readers,
There is an example to show a div on click using only css. You can use it as popup box also.

--css--

copytext

     .show , .hide{color:#FC6}
      #contain {display: none; border:1px solid #999;padding:10px;width:200px;margin-top:10px}
      .show:focus + .hide {display: inline; }
      .show:focus + .hide + #cont {display: block;}

--html--

       <div>
            <a href="#show" class="show">Show</a>
            <a href="#hide" class="hide">Hide</a>
            <div id="contain">
                This is hidden text
            </div>
       </div>

For such more blogs kindly visit to http://findnerd.com/NerdDigest/

No comments:

Post a Comment