Click here to Skip to main content
15,887,027 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
How can I apply border color darkred to input type date?

Thanks

What I have tried:

HTML
<div id="mandatory-text">
<input readonly="" tabindex="0" autocomplete="off" type="text" name="Date" class="rz-inputtext  rz-readonly" id="Date" placeholder="DD-MM-YYYY" onclick="Radzen.togglePopup(this.parentNode, 'popuppdfEW2DPWU')" _bl_11="">
</div>


CSS

CSS
#mandatory-text:has(.rz-inputtext.rz-readonly) {
        border-color: darkred !important;
    }
Posted
Updated 21-Jun-23 3:17am
v2

You can change -
#mandatory-text:has(.rz-inputtext.rz-readonly) {
        border-color: darkred !important;
    }


to -

#mandatory-text #Date {
        border-color: darkred !important;
    }


This is using the input element's id as well, same as what you did for the div element.

a Fiddle can be found HERE[^]
 
Share this answer
 
v2
Your CSS does set the border colour - at least in those browsers which support the :has selector[^].

But setting the border colour is not enough to make a border appear. The border-width defaults to 0, and the border-style defaults to none. So unless you have some other CSS which overrides those defaults for the #mandatory-text element, you will end up with an invisible dark red border, instead of an invisible transparent border. The end result is visually identical - no border will be shown, because it's invisible.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900