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