Reputation: 19
i was not able to align the date picker comes input type="datetime-local" to the right side of the input element enter link description here
input{
width:400px;
}
<input type="datetime-local" class="dateTime" name="starttime" id="startTime" step="2">
my requirement is to position that datepicker square to the right side without using javascript
expected result below::
Upvotes: 0
Views: 7822
Reputation: 739
Use this code this will help you.. I only use css for input: text-align:right.
input{
width:400px;
text-align:right;
}
<input type="datetime-local" class="dateTime" name="starttime" id="startTime" step="2">
Upvotes: 1
Reputation: 235
You cannot achive that, because you are trying to change a default browser property and every browser have custom css for distinct input types.
So if you wanna achieve that what you're have to use a custom datepicker an then do whatever you wanna do, and align it anywhere.
Upvotes: 0
Reputation: 908
If you want to align content of input to the right side, just use text-align: right;
in css.
I don't think it's possible to align calendar to the right ... But I also recommend you to use some js datetimepicker because of the browser support
Upvotes: 0
Reputation: 21
You can use div
tag so datetime-local
will be on the right side of the page as you want.
So your code will be :
<div align="right">
<input type="datetime-local" step="2">
</div>
Upvotes: 0