2017-06-29 39 views
1

我可以在IE11(Windows 7)中设置输入占位符文本的颜色,但我无法将输入占位符文本的文本溢出设置为省略号。无法在IE11中为输入占位符设置文本省略号

这里是重现此问题的jsfiddle(请打开IE11在Windows 7这个小提琴链接),

https://jsfiddle.net/1nku0aty/3/

HTML

<input type="text" placeholder="longtextlongtextlongtextlongtextlongtext"> 

CSS

input { 
    margin: 2em; 
} 
input:-ms-input-placeholder { 
    text-overflow: ellipsis; 
    overflow: hidden; 
    color: red; 
} 

有人可以帮助解决这个问题吗?

+0

这样一个很长的占位符文本,用省略号切断,会有什么意义呢?我永远无法完整地阅读它,所以首先它的目的是什么? [占位符已被认为是有害的](https://www.nngroup.com/articles/form-design-placeholders/) - 并且您需要在此之上添加一个额外的恶意用户层...? – CBroe

回答

0

像这样尝试。像往常一样,这在IE中不起作用。

input[placeholder]{ 
 
text-overflow:ellipsis; 
 
} 
 
input{ 
 
width:100px; 
 
}
<input type="text" placeholder="loremipsumdolorsitametconsetetur">

0

有更好的回答这个问题有关IE10:

Placeholder text-overflow:ellipsis in IE10 not working

基本上,显然这是行不通的,除非你让输入字段只读的,它有可能做一些hacky的JavaScript使它只读,除非你点击它,但如果你有选择去'呃什么,这是IE11和一个小毛病,谁在乎'你应该可能拿...

相关问题