I have this lightning layout and it's align end, but I need when it's mobile, the align need to be center and width 100%.
I told about use this css:
"@media screen and (max-width: 480px){}"
But I don't know if it's possible to edit an atribute like "horizontal-align", so, I also tried to align with css only but I didn't succeeded yet.
How do this?
<lightning-layout horizontal-align="end">
<div>
<lightning-layout-item size="12" medium-device-size="4" padding="around-medium">
<lightning-button variant="base" label="Cancel" onclick={cancel}></lightning-button>
</lightning-layout-item>
<lightning-layout-item size="12" medium-device-size="8" padding="around-medium">
<lightning-button variant="brand" label="Proceed" onclick={proceed} disabled={disabled}></lightning-button>
</lightning-layout-item>
</div>
</lightning-layout>
Best Answer
Yes, you can use media queries to alter the layout, but since we can't change custom component properties like we can normal properties, we'll just have to make two copies; one for the smaller view, and one for the larger view:
Now, you just need some CSS to go with it:
Demo.