Oliver
Oliver

Reputation: 65

How to define specific color for Bootstrap datetimepicker

Issue

I have two different projects both using bootstrap-datetimepicker. In one project, the color is correct. In the other one, the color is wrong. Here is my HTML.

<div class="form-group">
  <label for="StartDate">From</label>
  <input required id="StartDate" type="text" placeholder="Start Date" class="form-control input-xlarge mydatetime">
</div>

Code

Here is my code.

$('.mydatetime').datetimepicker({
  language:'en',
  format: 'yyyy-mm-dd hh:ii:ss',
  autoclose: true,
  todayBtn: true,
  minuteStep:5,
  pickerPosition: "bottom-right"
});

Both projects use exact the same way to use datetimepicker as shown above but show different results. I tried to change css locally by adding the following lines in the css file with no help.

.mydatetime {
  background-color: #fff ;
  color: #333 ;
}

Does anyone have idea what might go wrong here? Thanks a lot.

Upvotes: 2

Views: 987

Answers (3)

Varis
Varis

Reputation: 91

In datetimepicker dates and months take body default color. SO you have to add below code in your css.

.mydatetime td, .mydatetime th {
    color: #333;
}

Upvotes: 1

Sushmitha Kumaravel
Sushmitha Kumaravel

Reputation: 59

.ui-datepicker .ui-widget-content {
  background: #999 none;
}

Upvotes: 0

Ahmed Ali
Ahmed Ali

Reputation: 1964

To change the background color and font-color of datepicker do this.

.mydatetime{
   background: #333;
   border: 1px solid #555;
   color: #EEE;
}

Upvotes: 0

Related Questions