当静态定位时,:: before伪元素在孩子的内容之前堆叠(z-index),但是在孩子的背景之后.任何人都可以解释为什么甚至如何发生这种情况,或者这是否是所有主流浏览器都存在的问题?
<style>
div { background-color:yellow; width:400px; }
div::before { background-color:red; content:"div::before"; }
div::after { background-color:green; content:"div::after"; }
div p { background-color:blue; color:white; margin:-15px 0; padding:0; }
</style>
<div>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam sed tellus sed tellus sodales hendrerit tristique et elit.</p>
</div>
Run Code Online (Sandbox Code Playgroud)
最近,我注意到$是在没有使用任何JavaScript框架的网站上定义的函数.
在Firefox的firebug和Chrome的开发人员工具中,$被定义为document.getElementsByTagName(STRING)[0],document.getElementById(STRING_BEGINNING_WITH_#),document.getElementsByClassName(STRING_BEGINNING_WITH_PERIOD)[0]的简写函数.
现在在一些现代浏览器中定义了$,这是对ECMAScript的补充,还是只是这些特定的开发人员工具定义$?