0

I want to display the buttons in the footer section to the center and I'm using the modal container. I have tried multiple CSS but none of them are not working, could you please suggest me the correct approach

My Div:

<footer class="slds-modal__footer " >
     <lightning:button type="Cancel" label="Cancel" variant="neutral" onclick="{!c.cancelAction}"/>
     <lightning:button type="Submit" label="Save" variant="brand" />
</footer>  

Current one

1 Answer 1

1

You can use SLDS grid system.
With the slds-grid class you define a flexbox then with slds-grid_align-center class you set the alignment of its content.
So you can define a div with these two classes and putting the buttons inside

<footer class="slds-modal__footer">
    <div class="slds-grid slds-grid_align-center">
         <lightning:button type="Cancel" label="Cancel" variant="neutral" onclick="{!c.cancelAction}" />
         <lightning:button type="Submit" label="Save" variant="brand" class="slds-var-m-left_x-small" />
    </div>
</footer> 
``
1
  • It's working like a charm. Much appreciated
    – Pavan tej
    Commented Nov 10, 2021 at 13:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .