r/ionic•
NewQuark

Please help! Unable to align ion-icon within ion-fab-button.

​

Looks like this!

​

The HTML:

<ion-content fullscreen class="ion-padding">
    <div id="container">
        <app-columns>
        </app-columns>
        <ion-fab horizontal="end" vertical="center" slot="fixed">
            <ion-fab-button color="danger">
                <ion-icon name="add"></ion-icon>
            </ion-fab-button>
        </ion-fab>
    </div>
</ion-content>

CSS:

`#container {
    left: 0;
    right: 0;
    top: 30%;
    height: 100%;
}

Posted Apr 22, 2020, 2:46 PM UTC

12

I am trying to get a stackblitz example set up to help you, but I am not sure what version of Ionic you're using here. I do have a theory, though. Get rid of the whitespace inside your button, and/or add slot="icon-only" to your icon.

1
NewQuarkOP•

slot="icon-only" actually made the icon completely dissappear within the fab button.

I figured out what was wrong- I'd set a margin-right of 10px in the global style sheet smh.

2