html - on click hide this (button link) pure css -


my function hide , show div pure css when click open, button still not disappear.

<a href="#show" id="open" class="btn btn-default btn-sm">open</a> <div id="show">   text...   <a href="#hide" id="close" class="btn btn-default btn-sm">close</a> </div> 

and css like:

<style>     #show {display: none; }     #show:target { display: inline-block; }     #hide:target ~ #show { display: none; } <style> 

when add :

#show:target ~ #open { display: none; } 

the button #open still not hiding can me.

thanks before :)

you solve putting open link inside #show div

jsfiddle

html

<div id="show">     <a href="#show" id="open" class="btn btn-default btn-sm">open</a>     <div id="content">         text...         <a href="#hide" id="close" class="btn btn-default btn-sm">close</a>     </div> </div> 

css

#content {     display: none; } #show:target #content {     display: inline-block; } #show:target #open {     display: none; } 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -