I am new to lightning development. I was trying to learn about <lightning:layout>
and <lightning:layoutItem>
and came across one issue.
I have created two lightning layout items in a lightning layout. and keep the horizontal alignment as a center with the code <lightning:layout horizontalAlign="center">
but two layout items are not horizontally aligned properly. Please refer below screenshot.
Following is the code of the component
<aura:component implements="flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId" access="global" >
<aura:attribute name="buttonLabel" type="string" default="Search"/>
<aura:attribute name="isNewAvailable" type="boolean" default="true"/>
<lightning:layout horizontalAlign="center">
<lightning:layoutItem padding="around-medium">
<lightning:select name="select1" label="Car Types" value="" aura:id="carType" variant="label-hidden">
<option value="" label="All Types"/>
<option value="" label="Luxury Cars"/>
<option value="" label="Sports Cars"/>
</lightning:select>
</lightning:layoutItem>
<lightning:layoutItem padding="around-medium">
<lightning:button variant="brand" label="{!v.buttonLabel}"/>
<aura:if isTrue="{!v.isNewAvailable}">
<lightning:button variant="neutral" label="New"/>
<aura:set attribute="else">
New button cannot be added here!!
</aura:set>
</aura:if>
</lightning:layoutItem>
</lightning:layout>
</aura:component>