1
我有这个代码在Chrome和Internet Explorer中完美工作。但是每当我结合下面的CSS样式,它只能在Internet Explorer中工作,而不能在Chrome中工作。占位符风格不适用于铬?
有没有人关于这种奇特的行为?
.searchBar{
\t height:50px;
\t width:200px;
\t background-color:#9a005f;
\t color:#fff;
}
.searchBar:focus{
\t background-color:#9a445f;
}
.searchBar::-webkit-input-placeholder{
color:#fff;
}
.searchBar::-ms-input-placeholder{
\t color:#fff;
}
<input type="text" class="searchBar" placeholder="Search for..."/>
编辑: 下面是不是在我的铬工作,但在IE工作。
.searchBar{
\t height:50px;
\t width:200px;
\t background-color:#9a005f;
\t color:#fff;
}
.searchBar:focus{
\t background-color:#9a445f;
}
.searchBar::-webkit-input-placeholder,
.searchBar::-ms-input-placeholder{
color:#fff;
}
<input type="text" class="searchBar" placeholder="Search for..."/>
Chrome多年来一直不是webkit浏览器,现在大多数供应商前缀都在标志后面,所以我并不感到惊讶,您所做的不起作用。 – Rob
那么为什么它仅适用于'.searchBar :: - webkit-input-placeholder'? – Pratyush
您的代码片段适用于我的Chrome。 – Terry