
2 个回答
Probably too late for yourself but for anyone else struggling with this (like I was) I have a solution.
As their CSS is in the shadow DOM you can't override it but the padding-top value is set with a styling hook which you can adjust with your CSS.
If you look at the .slds-form-element__icon css it uses;
padding-top: var(--lwc-spacingXxSmall,0.25rem);
You can set a value for --lwc-spacingXxSmall with your own css class
:host .paddingOverride { --lwc-spacingXxSmall: 0px;}and apply this to your lightning-helptext to remove that annoying top padding.
<lightning-helptext content={tooltip} class="paddingOverride"></lightning-helptext>