I have below code for input text
<lightning-input label="Email" class="textInput" value={rec.Name} onchange={handleNameChange}></lightning-input>
Here I want to change the color of the label. I have tried it like this. But not working.
.textInput {
color: black;
font-weight: bold;
}
When I see the inspect element it looks like:
How should I write the css?
Best Answer
On the assumption you are talking LWC rather than Aura (since you reference "lightning-input" rather than "lightning:input"), LWC specifically restricts the parent from messing with the child component's presentation via the use of Shadow DOM.
As per the lightning-input documentation, there are no exposed means to apply the styling you wish to apply. The only way to apply any form of styling is via the "variant" attribute.