Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>A quick note on the :before and :after selectors in IE8: for them to work you need to declare a DOCTYPE. See <a href="http://www.w3schools.com/cssref/sel_after.asp" rel="nofollow noreferrer">this W3Schools page</a>. I am guessing you have already done this though.</p> <p>See the answer <a href="https://stackoverflow.com/questions/5540177/ie8-z-index-on-before-and-after-css-selectors">to this question</a> if you haven't already (I think you probably have).</p> <p>Basically, the bottom line is that it's a bug. Your solution of using a <code>z-index</code> of -1 is not <em>ideal</em>, but then again NO work around for the bug is going to be ideal. I don't think that using a z-index of -1 is something to be overly concerned about, unless it causes issues in your layout. If you are very concerned, then why don't you ONLY target IE8 w/ the fix. For example, you could use a conditional comment like so:</p> <pre><code>&lt;!--[if IE 8]&gt; &lt;style&gt; #target&gt;div{ z-index:-1; } &lt;/style&gt; &lt;![endif]--&gt; </code></pre> <p>Behaviors like the one you are experiencing is one of the reasons many developers despise IE. In many cases, including this one, there is no perfect solution. You could:</p> <ol> <li>stop using the <code>:before</code> and <code>:after</code> selectors &amp; adjust your HTML/CSS to something that is IE8-friendly.</li> <li>Use conditional comments or JavaScript to issue a fix that specifically targets IE8</li> <li>Keep hacking and try to find another HTML/CSS combo that works -- but chances are it won't be any more ideal than your negative <code>z-index</code> solution.</li> </ol> <p>Unfortunately, in many cases there is no such thing as a "semantically correct" cross-browser website.</p> <p>My two cents is to create an IE8 stylesheet and use the conditional comment I displayed above to load the stylesheet. Within the stylesheet, use the <code>z-index: -1</code> solution you came up with. Many websites use IE-targeted stylesheets.</p>
    singulars
    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.
    1. This table or related slice is empty.
    1. VO
      singulars
      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