在Firefox 3和Google Chrome 8.0中,以下工作正常:
<style type="text/css">
span:before { content: 'span: '; }
</style>
<span>Test</span> <!-- produces: "span: Test" -->
Run Code Online (Sandbox Code Playgroud)
但是当元素是<input>:
<style type="text/css">
input:before { content: 'input: '; }
</style>
<input type="text"></input> <!-- produces only the textbox; the generated content
is nowhere to be seen in both FF3 and Chrome 8 -->
Run Code Online (Sandbox Code Playgroud)
为什么它不像我预期的那样工作?
我想使用»相邻链接之间的HTML 实体格式化链接的痕迹痕迹,所以它看起来像这样:
我在CSS中添加了一条规则:
nav#breadcrumb-trail a:after {
content: " » ";
}
Run Code Online (Sandbox Code Playgroud)
但这是在链接中添加实体,而不是在外面 - 即我得到这个:
我误解了CSS :after伪元素的行为吗?文档似乎意味着它在指定元素之后添加指定的内容,而不是将其添加到元素容器的内部.有任何想法吗?
我希望能够使用::outside伪元素,但显然没有主流浏览器支持它(基于我今天的测试).
是否有某种JS polyfill启用此选择器?或者有一种很好的模拟技术吗?