How to remove this huge distance between label and input in LWC. I didn't use custom styles, only from the salesforce lightning design system.
Here's my code from the HTML file:
<div>
<template if:true={locatedOnTab}>
<lightning-input type="text" name="Page number" label="Now page number" value={nowPageNumber} variant="label-inline" readonly></lightning-input>
<lightning-button variant="brand" label="Previous" title="PreviousPageButton" onclick={handlePaginationClick} class="slds-m-left_x-small" disabled={previousButtonDisabled}></lightning-button>
<!--I think this code is not important--!>
</template>
</div>
Best Answer
You could use
label-hidden
variant, define your own div for the label and put both elements (label and lightning-input) in a flex box:By the way,
readonly
is wrong, the right attribute isread-only
. SpecificationsI also changed the type of lightning-input to
number
.However if you don't need a lightning-input, you could also change it to: