<分区>
我的这段代码在 chrome 和 Internet Explorer 中运行得很好。但是每当我像下面这样组合 CSS 样式时,它只在 Internet explorer 中运行而不在 chrome 中运行。
有人知道这种奇怪的行为吗?
.searchBar{
height:50px;
width:200px;
background-color:#9a005f;
color:#fff;
}
.searchBar:focus{
background-color:#9a445f;
}
.searchBar::-webkit-input-placeholder{
color:#fff;
}
.searchBar::-ms-input-placeholder{
color:#fff;
}
<input type="text" class="searchBar" placeholder="Search for..."/>
编辑: 以下内容不适用于我的 chrome,但适用于 IE。
.searchBar{
height:50px;
width:200px;
background-color:#9a005f;
color:#fff;
}
.searchBar:focus{
background-color:#9a445f;
}
.searchBar::-webkit-input-placeholder,
.searchBar::-ms-input-placeholder{
color:#fff;
}
<input type="text" class="searchBar" placeholder="Search for..."/>