2014-04-25 44 views
0

考虑下面的HTML:定位仿伪元素:后在Firefox

<table> 
    <thead> 
     <tr> 
      <th class="title">Test title</th> 
     </tr> 
    </thead> 
</table> 

下面CSS:

table { 
    width: 400px; 
    border: 1px solid #ccc; 
} 

th.title { 
    position: relative; 
    text-align: center; 
} 

th.title::after { 
    position: absolute; 
    right: 5px; 
    content: '>'; 
} 

见的jsfiddle http://jsfiddle.net/63EZB/1

我想要的是出现在th右侧的大于号。上面的代码适用于Chrome和IE8 +,但不适用于Firefox(28)。 Firefox将标记绝对放在窗口的右侧,就像位置的th元素没有考虑。

怎么回事?

+0

http://jsfiddle.net/63EZB/4/这在 – bksi

+0

工作问题是,你的th是与显示:内联代替块 – bksi

回答

1

寻找这样的事情Link

CSS:

th.title::after {  
    margin-right: 5px; 
    float:right; 
    content:'>'; 
} 
+0

漂亮和优雅/更好的解决方案。你能解释为什么这个浮动不需要清除吗? – hvtilborg

0

尝试用论文规则:

th.title:after { 
    position:relative; 
    float:right; 
    right: 5px; 
    content: '>'; 
}