一、web 設(shè)置placeholder
設(shè)置瀏覽器的placeholder樣式
::-webkit-input-placeholder { /* WebKit browsers */
color: #999;
}
:-moz-placeholder { /* Mozilla Firefox 4 to 18 */
color: #999;
}
::-moz-placeholder { /* Mozilla Firefox 19+ */
color: #999;
}
:-ms-input-placeholder { /* Internet Explorer 10+ */
color: #999;
}
二、微信小程序設(shè)置placeholder
在小程序中設(shè)置placeholder樣式需要使用組件的內(nèi)置屬性??梢酝ㄟ^以下方式設(shè)置input和textarea的placeholder樣式:
<!-- input組件 -->
<input placeholder-style="color:#999;font-size:14px;" />
<!-- textarea組件 -->
<textarea placeholder-style="color:#999;font-size:14px;"></textarea>
在上面的示例中,placeholder-style屬性被設(shè)置為一個字符串,包含了CSS樣式。在這個字符串中,您可以設(shè)置任何CSS樣式屬性,例如顏色、字體大小、字體樣式等。
請注意,這些屬性僅適用于placeholder文本,而不是輸入的文本。如果您需要設(shè)置輸入文本的樣式,應(yīng)該將樣式應(yīng)用到輸入框或文本域本身。
三、歡迎交流指正
參考鏈接
關(guān)于微信小程序設(shè)置placeholder樣式最簡便操作_善良美麗大方可愛真棒的博客-CSDN博客文章來源:http://www.zghlxwxcb.cn/news/detail-763014.html
設(shè)置placeholder屬性樣式的多種寫法_placeholder樣式_李梅思的博客-CSDN博客文章來源地址http://www.zghlxwxcb.cn/news/detail-763014.html
到了這里,關(guān)于CSS:瀏覽器設(shè)置placeholder樣式 / 微信小程序設(shè)置placeholder樣式的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!