HTML5 日期選擇器的樣式選項


HTML5 中的日期選擇器基本上工作方式與 JavaScript 庫非常相似,當我們專注於該欄位時,將彈出日曆,然後我們可以在月份和年份中導航以選擇日期。

因此,如果你希望日期輸入使用更多的間距和配色方案,則可以將以下內容新增到程式碼中。

::-webkit-datetime-edit { padding: 2 em; }
::-webkit-datetime-edit-fields-wrapper { background:green; }
::-webkit-datetime-edit-text { color: blue; padding: 0 0.3em; }
::-webkit-datetime-edit-month-field { color: red; }
::-webkit-datetime-edit-day-field { color: orange; }
::-webkit-datetime-edit-year-field { color: red; }
<input type = "date">

更新於:02-06-2020

2K+ 次瀏覽

開啟你的知識旅程 職業生涯

完成課程並獲得認證

開始學習
廣告
© . All rights reserved.