I have the HTML below. In order to get green text in the text input
I have to inherit the color
from the parent <span>
; otherwise, the text input
would have black text. Why is this necessary? Why doesn't the input
element just inherit the color
property from its parent?
Are there other other elements that don't inherit properties from their ancestors?
<p>Without color: inherit;</p>
<div style="color: darkgreen;">
<input type="text" value="Displays black" />
</div>
<p>With color: inherit;</p>
<div style="color: darkgreen;">
<input type="text" style="color: inherit;" value="Displays green" />
</div>