Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: [SOLVED] How to center button in footer bar or header bar #4144

Closed
EricDosReis opened this issue Jul 24, 2015 · 1 comment
Closed

bug: [SOLVED] How to center button in footer bar or header bar #4144

EricDosReis opened this issue Jul 24, 2015 · 1 comment

Comments

@EricDosReis
Copy link

Type: bug

Platform: all

I'm trying to center a button in a footer bar, but I can't. I tried many techniques, but nothing works.

I tried margin auto technique:

    .button {
         display: block;
         float: none;
         margin-left: auto;
         margin-right: auto
     }

I tried position absolute technique:

    .button {
         position: absolute;
         left: 0;
         right: 0
     }

I tried set display flex to footer bar:

    .bar-footer {
         display: flex
    }

    .button {
         align-self: center
     }

center-button-in-footer-bar

Someone can help me?

@EricDosReis EricDosReis changed the title How Center button in footer bar or header bar bug: How Center button in footer bar or header bar Jul 24, 2015
@EricDosReis EricDosReis changed the title bug: How Center button in footer bar or header bar bug: How to center button in footer bar or header bar Jul 25, 2015
@EricDosReis
Copy link
Author

Okay, I solved my problem creating my own footer bar. Here is the code:

Footer bar code:

<ion-footer-bar class="footer-bar-custom">
    <button class="footer-bar-item item-left user-profile-button button button-clear">
        <img class="user-image rounded" src="../img/user-photo.jpg" alt="User Photo">
    </button>

    <a class="footer-bar-item item-center button button-clear button-icon ion-grid"
        ui-sref="home"
        nav-direction="back"></a>

    <button class="footer-bar-item item-right button button-clear button-icon
        ion-android-more-vertical"
        ng-click="popover.show($event)">
    </button>
</ion-footer-bar>

Footer bar CSS custom settings:

/**
 * ion-footer-bar custom styles
 */
.footer-bar-custom {
    background: #455D87;
    color: #F6F7F0;
    height: 44px;
    width: 100%;
    position: absolute;
    bottom: 0;
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
    z-index: 5
}

    .footer-bar-custom .item-left,
    .footer-bar-custom .item-center,
    .footer-bar-custom .item-right {
        position: absolute;
        width: 30px
    }

    .footer-bar-custom .item-left { left: 10px }

    .footer-bar-custom .item-center {
        left: 50%;
        -webkit-transform: translateX(-50%);
        transform: translateX(-50%)
    }

    .footer-bar-custom .item-right { right: 10px }

Ionic custom CSS settings:

a.button .icon:before,
a.button.icon:before,
a.button.icon-left:before,
a.button.icon-right:before { margin-top: 0 }

This is the result:

ionic custom footer bar

Thank for building Ionic guys!

@EricDosReis EricDosReis changed the title bug: How to center button in footer bar or header bar bug: [SOLVED] How to center button in footer bar or header bar Jul 28, 2015
@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant