html5中如何去掉input type date默認樣式
HTML代碼:?
選擇日期:?
選擇時間:?
選擇星期:?
選擇月份:
目前WebKit下有如下9個偽元素可以改變?nèi)掌诳丶腢I:
::-webkit-datetime-edit?– 控制編輯區(qū)域的
::-webkit-datetime-edit-fields-wrapper?– 控制年月日這個區(qū)域的
::-webkit-datetime-edit-text?– 這是控制年月日之間的斜線或短橫線的
::-webkit-datetime-edit-month-field?– 控制月份
::-webkit-datetime-edit-day-field?– 控制具體日子
::-webkit-datetime-edit-year-field?– 控制年文字, 如2017四個字母占據(jù)的那片地方
::-webkit-inner-spin-button?– 這是控制上下小箭頭的
::-webkit-calendar-picker-indicator?– 這是控制下拉小箭頭的
::-webkit-clear-button?–這是控制清除按鈕的
以下的囊括了date碾篡,datetime,week牡拇,time所用的偽元素:?
input::-webkit-datetime-edit{}?
input::-webkit-datetime-edit-fields-wrapper{}?
input::-webkit-datetime-edit-ampm-field{}?
input::-webkit-datetime-edit-day-field{}?
input::-webkit-datetime-edit-hour-field{}?
input::-webkit-datetime-edit-millisecond-field{}?
input::-webkit-datetime-edit-minute-field{}?
input::-webkit-datetime-edit-month-field{}?
input::-webkit-datetime-edit-second-field{}?
input::-webkit-datetime-edit-week-field{}?
input::-webkit-datetime-edit-year-field{}?
input::-webkit-datetime-edit-ampm-field:focus{}?
input::-webkit-datetime-edit-day-field:focus{}?
input::-webkit-datetime-edit-hour-field:focus{}?
input::-webkit-datetime-edit-millisecond-field:focus{}?
input::-webkit-datetime-edit-minute-field:focus{}?
input::-webkit-datetime-edit-month-field:focus{}?
input::-webkit-datetime-edit-second-field:focus{}?
input::-webkit-datetime-edit-week-field:focus{}?
input::-webkit-datetime-edit-year-field:focus{}?
input::-webkit-datetime-edit-year-field[disabled]{}?
input::-webkit-datetime-edit-month-field[disabled]{}?
input::-webkit-datetime-edit-week-field[disabled]{}?
input::-webkit-datetime-edit-day-field[disabled]{}?
input::-webkit-datetime-edit-ampm-field[disabled]{}?
input::-webkit-datetime-edit-hour-field[disabled]{}?
input::-webkit-datetime-edit-millisecond-field[disabled]{}?
input::-webkit-datetime-edit-minute-field[disabled]{}?
input::-webkit-datetime-edit-second-field[disabled]{}?
input::-webkit-datetime-edit-text{}?
input::-webkit-inner-spin-button{}?
input::-webkit-calendar-picker-indicator{}?
input::-webkit-calendar-picker-indicator:hover{}
date類型改變行高和高度那個小三角并不會根據(jù)大小調(diào)整惠呼,實在太丑了峦耘,所以決定把它隱藏掉。?
下面的css可以去掉date中上下小三角辅髓,但是保留input類型為number的小三角少梁。?
input[type=date]::-webkit-inner-spin-button { visibility: hidden; }?
input類型為date的輸入框有以下屬性律想,可以根據(jù)自己的需求自行調(diào)整绍弟。?
::-webkit-datetime-edit { padding: 1px; background: url(../selection.gif); }?
::-webkit-datetime-edit-fields-wrapper { background-color: #eee; }?
::-webkit-datetime-edit-text { color: #4D90FE; padding: 0 .3em; }?
::-webkit-datetime-edit-year-field { color: purple; }?
::-webkit-datetime-edit-month-field { color: blue; }?
::-webkit-datetime-edit-day-field { color: green; }?
::-webkit-inner-spin-button { visibility: hidden; }?
::-webkit-calendar-picker-indicator {?
border: 1px solid #ccc;?
border-radius: 2px;?
box-shadow: inset 0 1px #fff, 0 1px #eee;?
background-color: #eee;?
background-image: -webkit-linear-gradient(top, #f0f0f0, #e6e6e6);?
color: #666;?
}
日期
1
去掉上下箭頭按鈕則需要對date默認樣式進行修改在樣式中添加
input[type=date]::-webkit-inner-spin-button{visibility: hidden;}
1
2
3
則日期樣式改為:?