Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy does IE10 require the presence of a p:hover {} rule for transitions to work on a pseudo element?
    primarykey
    data
    text
    <p>HTML:</p> <pre><code>&lt;p&gt;Hover&lt;/p&gt; </code></pre> <p>CSS:</p> <pre class="lang-css prettyprint-override"><code>p::after { content: " here"; transition: all 1s; } p:hover::after { font-size: 200%; color: red; } </code></pre> <p><strong>Live demo:</strong> <a href="http://jsfiddle.net/SPHzj/13/" rel="nofollow">http://jsfiddle.net/SPHzj/13/</a> (works in Firefox and Chrome)</p> <p>As you can see, I've set up CSS transitions on the <code>::after</code> pseudo-element of the paragraph. Then, when the paragraph is hovered, two new styles apply for the pseudo-element which are transitioned.</p> <p>This works in Firefox and Chrome, but not in IE10. My reasoning was that IE doesn't understand the <code>p:hover::after</code> selector, as it works in IE if you set the hover on an ancestor element, e.g. <code>div:hover p::after</code> - live demo: <a href="http://jsfiddle.net/SPHzj/14/" rel="nofollow">http://jsfiddle.net/SPHzj/14/</a>.</p> <p>However, this is not the case, as IE is indeed able to understand that selector. The trick is to define a <code>p:hover {}</code> rule as well. (Discovered by <a href="https://twitter.com/maxw3st/status/323262053823434752" rel="nofollow">@maxw3st</a>.) </p> <pre class="lang-css prettyprint-override"><code>p:hover {} </code></pre> <p>This rule can be empty. The mere presence of this rule will make the transitioning work in IE10. </p> <p><strong>Live demo:</strong> <a href="http://jsfiddle.net/SPHzj/15/" rel="nofollow">http://jsfiddle.net/SPHzj/15/</a> (also works in IE10)</p> <p>What's going on here? Why does IE require that rule to be present in order for transitions to work on the pseudo-element? Should this be considered a bug?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload