關于 DatePicker,我有兩個簡單的問題:
- 如何更改 CSS 中 datePicker 的背景顏色?例如,我想將綠色更改為藍色?
日期選擇器影像
(僅供參考,我不能使用JS)
- 如何在輸入右側添加“日歷”圖示?
HTML
<div class="container">
<input
type="text"
#dp="bsDatepicker"
bsDatepicker
[(bsValue)]="myDateValue"
/>
</div>
CSS
.container {
display: flex;
flex-direction: row;
justify-content: center;
margin-top: 50px;
}
::ng-deep.bs-datepicker {
height: 350px;
}
.custom-content {
position: absolute;
z-index: 1081;
top: 390px;
cursor: pointer;
align-self: center;
}
這是這里的代表
謝謝
uj5u.com熱心網友回復:
對于日期選擇器的樣式,您可以這樣做
::ng-deep.bs-datepicker .bs-datepicker-head{
background-color: blue !important;
}
::ng-deep.bs-datepicker .selected{
background-color: blue !important;
}
對于您需要將其添加到 html 上的圖示,而不是設定它的樣式。
<div class="inputContainer" >
<input
type="text"
#dp="bsDatepicker"
bsDatepicker
[(bsValue)]="myDateValue"
/>
<span class="inputIcon">
<img
src="https://www.svgrepo.com/show/7168/calendar.svg"
>
</span>
</div>
::ng-deep.bs-datepicker .bs-datepicker-head{
background-color: blue !important;
}
::ng-deep.bs-datepicker .selected{
background-color: blue !important;
}
這是演示https://stackoverflow-51062003-6khnoa.stackblitz.io
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/450681.html
標籤:css
