Change css style of an element by clicking another

css

Solution

You can do this with CSS!

If you change your HTML markup a little bit you can achieve this by using CSS `:target`

    #d2:target {
        display: none;
    }
    <div id="d1">
      Text
    <div id="d2">Word
      <a href="#d2">My other text</a>
    </div>

Problem

I've got this structure: ``` <div id="d1"> Text <div id="d2">Word</div> <a href="#hide">My other text</a> </div> ``` Now, I want that on click to `#hide:target`, `div#d2` disappear. Can I do this with CSS?

Original source