UPDATED: Still with some really funky finale!
Believe it or not, this code works in FF, Chrome, IE9 and 10 to do what you want ( see example ). Yes, this is a โhack,โ as Pumbaa80 noted. But I like to make โworkingโ hacks for things that seem impossible. Yes, because of the "hacking" it will not work in all situations (maybe not in your "real" situation in the world).
Achieved Update
- I believe that I developed a small bug in FF and Chrome that would make it sometimes still display when not only
<a> . - I figured out how to get IE to work by putting the
body:before pseudo-element in z-index: -1 between #p1 ( z-index: -2 ) and the parent of div #out . To work :before must have a background-color , and then opacity: 0 (without it, as if it didnโt even exist for "blocking" purposes). Understand that there are at least two side effects (possibly several others) of this blocking: (a) The links in #p1 will not be clickable, and (b) since the OP is marked in the comment, the text in #p1 will not be selected .
Here is the modified code mostly just for the effect, but I added the combined code for the original effect #p1 hover to now disable #out:hover . However, the code does that only <a> inside #out launches that #out:hover :
body:before { content: ''; position: absolute; top: 0; right: 0; bottom: 0; left: 0; z-index: -1; background-color: cyan; opacity: 0; } #out { height: 0; } #out:hover #p1, #out:hover + div p { background-color: red; } #out a { float: left; } #p1 { float: left; width: 100%; position: relative; z-index: -2; } #sec { clear: left; }
Obviously, out-of-relationship elements are a major issue with a clean CSS solution. What I tried to achieve here (mostly successfully for the main browsers ... that know about mobile, etc. Browsers) capitalizes the relations of the parent element in such a way that it makes only <a> freeze (within this, the first parent element) is the only trigger for :hover the parent element itself, so I could use it to create freezing effects for all <p> elements.
source share