2017-03-23 29 views
-1

这里没有太多的评论...我试图设置文本溢出省略号在一个div上,同时有一个固定的div与其他地方的背景页面,这似乎并没有在Firefox是工作(但与Chrome浏览器)......下面的代码:省略号在火狐中没有显示固定div与背景颜色

.fixed { 
 
    position: fixed; 
 
    background-color: #fff; 
 
} 
 

 
.ellipsis { 
 
    width: 200px; 
 
    white-space: nowrap; 
 
    overflow: hidden; 
 
    text-overflow: ellipsis; 
 
}
<div class="fixed"> 
 
    asdf 
 
</div> 
 
<div class="ellipsis"> 
 
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. 
 
</div>

回答

0

使用overflow: hiddenwhite-space: nowrap为固定股利。

检查片段

.fixed { 
 
    position: fixed; 
 
    background-color: #fff; 
 
    top: 50px; 
 
    
 
    width: 120px; 
 
    white-space: nowrap; 
 
    text-overflow: ellipsis; 
 
    overflow: hidden; 
 
    
 
} 
 

 
.ellipsis { 
 
    width: 200px; 
 
    white-space: nowrap; 
 
    overflow: hidden; 
 
    text-overflow: ellipsis; 
 
}
<div class="fixed"> 
 
    this is the demo text to rere 
 
</div> 
 
<div class="ellipsis"> 
 
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. 
 
</div>

+0

感谢您的回答,但它似乎并没有工作......(仍在使用火狐) –

+0

但它工作在这里很好的http:/ /prntscr.com/enim0x你的Firefox是什么版本? – Lucian

+0

哦,对不起,没有提及:它在代码段中工作,但不在空白网页上......我也可以在代码片段中看到椭圆,但是当我将它复制粘贴到Sublime Text中并将其上传到我的网站,它不显示:/ –