The reason your CSS is not working is due to two small errors.
First, .head.hover defines two class selectors .head and .hover , while you really want :hover user action pseudo class.
Secondly, .head.hover ~ .tip uses ~ common sibling combinator, which will only apply to the .head.hover element preceded by the .tip element, i.e. Elements must "share the same parent element in the document tree." You can use either the offspring compiler or the child combinator to target the .tip child. I used the latter in the following example:
Thus, fixing these issues leads to CSS:
.head:hover > .tip { color: red; } .tip { color: black; }
which changes the color of the tip on hover.
Regarding CSS click events, there are many different ways to achieve CSS click events, as described in the blog you are attached to.
One that might work for your situation is an approach :focus , which relies on an element with tabindex .
HTML
<div class="head" tabindex="1"> <div class="content"> content </div> <div class="tip"> tip </div> </div>
CSS
.head .tip { display:none; } .head:focus .tip { display:block; }
See demo
source share