0

I run out of an idea to fix this justify-content:space-between; in Chrome, Microsoft Edege work but in Firefox and IE not correctly layout any idea ? here is codepen preview

HTML

            <nav>
                <button class="navbar-toggle collapsed" id="navbar-toggle">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar top-bar"></span>
                    <span class="icon-bar middle-bar"></span>
                    <span class="icon-bar bottom-bar"></span>
                </button>
                <div class="setting-toggle" >
                    <div class="dropdown-toggle" id="setting-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></div>
                    <ul class="dropdown-menu dropdown-menu-right" role="menu">
                        <li><a href=""><i class="fa fa-user-plus fa-fw"></i> User Page</a></li>
                        <li><a href=""><i class="fa fa-sign-out fa-fw"></i> Logout</a></li>
                    </ul>
                    <div class="cleafix"></div>
                </div>
                <div id="goto-home-page">
                    <div data-toggle="dropdown">Admin Panel</div>
                    <ul class="dropdown-menu" role="menu">
                        <li><a href="" target="_blank">Home Page</a></li> 
                    </ul>
                </div>
            </nav>

Scss syntax

    $default_nav_color : #0C0C0C;
    $default_active_color : #333;
    $default_hover_color : #298fcc;
    $default_background_color : rgba(41, 143, 204, 0.1);
    html, body {
        font:{
            family: 'Roboto', 'Open Sans';
            weight: normal;
            size: inherit;
        }
        color:#fff;
        overflow:hidden;
    }
nav{
    position:fixed;
    height:56px;
    color:#fff;
    width:100%;
    background: $default_nav_color;
    /*border-bottom:2px double #9E9E9E;*/
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:0 0 0 250px;
    z-index:1004;
    div{
        position:relative;
    }
    #goto-home-page{
        position:fixed;
        font-size:20px;
        border-bottom:1px ridge rgba(255, 255, 255, 0.04);
        display:flex;
        align-items:center;
        top:0;
        left:0;
        width:250px;
        height:56px;
        background:$default_active_color;
        &:hover{
            cursor:pointer;
        }

        ul{
            border-radius:0;
            margin:0;
            padding:0;
            background:$default_active_color;
            box-shadow: -1px 0 8px #fff;
            li{
                padding:15px;
            }
            li:hover{
                background: $default_background_color;
            }
            li a{
                color:#fff;
                padding:0 15px;
                &:hover, &:focus{
                    background:none;
                    color: $default_hover_color;
                }
            }
        }
        div,ul{
            width:100%;
            text-align:center;
        }
    }
}

in Chrome, Microsoft edege

|----------------|------------------------------------------------------------|
|      Admin     | Icon                                                   Icon|
|----------------|------------------------------------------------------------|

in Firefox, IE not correctly layout

|----------------|------------------------------------------------------------|
|      Admin     | Icon                    Icon                               |
|----------------|------------------------------------------------------------|
Michael Benjamin
  • 346,931
  • 104
  • 581
  • 701
Reaksmey
  • 205
  • 2
  • 7
  • 15
  • 1
    Why would you not describe what's going wrong? – connexo Nov 03 '16 at 09:13
  • What version of IE and firefox are you having problems with? – Andrew Nov 03 '16 at 09:20
  • @Andrew Firefox 48.0.2, IE 11 – Reaksmey Nov 03 '16 at 09:22
  • 1
    If the whole navbar is `position:fixed` why is the `#goto-home-page` **also** fixed. FF is taking the size of that element into account (which it shouldn't, TBH) – Paulie_D Nov 03 '16 at 10:32
  • @Paulie_D reason why i use this fixed because Admin tab that has `width 250px` to have same Background as my Left menu so i set` nav padding-left 250px` for this `#goto-home-page` – Reaksmey Nov 03 '16 at 11:00
  • But there's no reason why it should have position fixed at all. It's in a fixed div as it stands, – Paulie_D Nov 03 '16 at 11:01
  • @Paulie_D thz this is a problem no matter what i give `#goto-home-page` to `abosolute/fixed`. `justify-content:space-between;` still count this into account that why it split into 3 part in Firefox, IE . – Reaksmey Nov 03 '16 at 11:11
  • Looks like a bug in FF. I'd wrap the button and `setting-toggle` div in their *own* wrapper and flex **that** – Paulie_D Nov 03 '16 at 11:23
  • This is a known issue. Flex items that are absolutely positioned (includes `fixed`), are NOT removed from the normal flow when Firefox and IE11 calculate `justify-content` or other flex alignment rules. – Michael Benjamin Nov 03 '16 at 14:34

0 Answers0