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.